Note that there are some explanatory texts on larger screens.

plurals
  1. POINVALID_NODE_TYPE_ERR in jQuery when doing multiple selectors on Chrome
    primarykey
    data
    text
    <p>I'm doing a jQuery multiple selector find: </p> <pre><code>element.find("fieldset, input[type=hidden], input[type=text], :radio") </code></pre> <p>and in Chrome version 1 it gives this error "INVALID_NODE_TYPE_ERR: DOM Range Exception 2" on <a href="http://dev.jquery.com/browser/trunk/jquery/src/selector.js#L722" rel="nofollow noreferrer">line 722 of jquery's selector.js</a></p> <pre><code>aRange.selectNode(a); </code></pre> <p>in context:</p> <pre><code>function(a, b) { var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange(); aRange.selectNode(a); aRange.collapse(true); bRange.selectNode(b); bRange.collapse(true); var ret = aRange.compareBoundaryPoints(Range.START_TO_END, bRange); if (ret === 0) { hasDuplicate = true; } return ret; } </code></pre> <p>in this case, <code>a</code> is a HTML hidden input field. From what I can find, it <em>seems</em> to be an issue with the older webkit version, as this error doesn't occur in the new beta of Chrome (probably because it never hits this code because it implements <code>document.documentElement.compareDocumentPosition</code> see <a href="http://dev.jquery.com/browser/trunk/jquery/src/selector.js#L703" rel="nofollow noreferrer">selector.js#703</a>).</p> <p>To step around this problem, I've replaced the multi-selector with four single selects which I merge together which works fine, but it's really ugly:</p> <pre><code>elements = element.find('fieldset') .add(element.find('input[type=hidden]')); .add(element.find('input[type=text]')); .add(element.find(':radio')); </code></pre> <p>Is this really the only way around this, or is there something else I can do?</p> <p><strong>UPDATE</strong> There is a <a href="http://groups.google.com/group/sizzlejs/browse_thread/thread/f8858e82cd886b56" rel="nofollow noreferrer">thread about this on the Sizzle discussion forum</a>, a possible patch to the Sizzle (jQuery selector) code has been posted, this may find its way into jquery core. It seems to only be an issue when doing a multiple selector on dynamic code</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload