diff options
| author | Keyamoon | 2012-12-20 03:18:47 +0330 | 
|---|---|---|
| committer | Igor Minar | 2013-01-08 14:54:56 -0800 | 
| commit | c0995399d4226504069f1b9e378260d0553c1fcc (patch) | |
| tree | 037fcb394f44bca3267823cbe7c992b9fa02729c /src/jqLite.js | |
| parent | de6cc287e51dcdd91c63d7427dbdc28cae111ad5 (diff) | |
| download | angular.js-c0995399d4226504069f1b9e378260d0553c1fcc.tar.bz2 | |
fix(jqLite): make next() ignore non-element nodes
next() is supposed to return the next sibling *element* so it
should ignore text nodes. To achieve this, nextElementSibling()
should be used instead of nextSibling().
Diffstat (limited to 'src/jqLite.js')
| -rw-r--r-- | src/jqLite.js | 11 | 
1 files changed, 10 insertions, 1 deletions
diff --git a/src/jqLite.js b/src/jqLite.js index 7b6e5da9..2afcef54 100644 --- a/src/jqLite.js +++ b/src/jqLite.js @@ -717,7 +717,16 @@ forEach({    },    next: function(element) { -    return element.nextSibling; +    if (element.nextElementSibling) { +      return element.nextElementSibling; +    } + +    // IE8 doesn't have nextElementSibling +    var elm = element.nextSibling; +    while (elm != null && elm.nodeType !== 1) { +      elm = elm.nextSibling; +    } +    return elm;    },    find: function(element, selector) {  | 
