I have a table with rows created by ng-repeat. The table headers have ng-click, which sets the predicate for sorting (the function also determines the direction, asc / desc). Sorting works fine, but for some reason I get jQuery exceptions every time I change the predicate and sorts the fire.
Here is a plunkr example of what I'm doing: http://plnkr.co/edit/qfNcm9RPQSsNgqmm3TYS?p=preview
As you can see in plnkr, ng-repeat is pretty simple. Ng-repeat in our project is similar and not more complicated.
<tr ng-repeat="contest in AllContests | orderBy:sort:ReverseSort" ng-show="contest.isVisible">
This does occur in a number of places in our code, and we use different sorting methods among them, but they are still affected.
Table headers can be clicked to sort items. This problem does not detect a problem. Despite the fact that sorting works on my page, it breaks other things on the page (for example, controlling a transparent carousel ). The exception is line 1430 in jquery.js (version 2.1.1 via Google CDN, which includes Sizzle.js). The method in which the exception occurs is Sizzle.attr. What seems to be happening is a loop of all the elements created with ng-repeat, and getting the attribute values from them. An exception occurs when it falls into the comment "end ngRepeat: contest in AllContests | orderBy: sort: ReverseSort", meaning the end of the ng-repeat section.
In particular, I get "Uncaught TypeError: undefined is not a function" when it tries to getAttribute () for an element.
return val !== undefined ?
val :
support.attributes || !documentIsHTML ?
elem.getAttribute( name ) :
(val = elem.getAttributeNode(name)) && val.specified ?
val.value :
null;
jquery, , , elem.nodeName == "#comment" null . , - .
jquery?
:
https://playmlf.com/Lobby/ContestLobby
jQuery , :
Sizzle.attr = function (elem, name) {
if (elem.nodeName == '#comment') return null;
if ( ( elem.ownerDocument || elem ) !== document ) {
setDocument( elem );
}
. Sizzle.attr. if . null, . jquery, , . , -, . .