'contains' method's error #135
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
CODE
function contains(doc, selectors, el) { for (var i = 0; i < selectors.length; i++) { var selectedEls = doc.querySelectorAll(selectors[i]) for (var j = 0; j < selectedEls.length; j++) { if (selectedEls[j].contains(el)) { return true } } }Situations
I coded that invoke manual pjax call on
<select>element's change event. And then doc.querySelectorAll line in code above, occurred error.Error message
Uncaught TypeError: doc.querySelectorAll is not a function
Parameters in debug
doc = ["pjax-container"]
selectors = select#category_sel
el = undefined
Did I mistake?
Thank you!
@venzersiz Can you post the complete stack trace?
pjax.js:981 Uncaught TypeError: doc.querySelectorAll is not a function
at contains (pjax.js:981)
at Pjax.loadContent (pjax.js:133)
at Pjax. (pjax.js:202)
at XMLHttpRequest.request.onreadystatechange (pjax.js:780)
You're right, that's a bug.
This line:
should be:
Thank you for your guide line.