Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Android - document.contains #686
util/inserted/inserted.js provide can.inserted which checks if the given elements belong to the document DOM tree.
This rely on can.has which itself rely on the DOM library (zepto, jquery....) which rely on browser contains native method (at least for zepto).
document.contains isn't provided by android stock browser and so, can.inserted fails and so can.view can't render.
I assume it would be better to check on document.body instead of document.
referenced this pull request
Jan 21, 2014
Yep, why not; document.documentElement is document.childNodes. As I said, I'm not sure it has some interest to check in the full HTML fragment (document.documentElement / document.childNodes) as the HTML Head may reference quite lot of nodes (even more when we use an AMD loader like Require). But if some people may have interest to use can.inserted in order to check if an element is in the Head, then why not :)
added a commit
this pull request
Jan 22, 2014
Jan 22, 2014
1 check passed
"This seems to specifically occur when using Zepto (not if you run the tests without a library)."
Also, you added a condition in order to continue to use contains on document; that's not right, if you want to check on the full document, then use document.documentElement, if you prefer to check only on body, then use document.body : then there is no need to add a condition as both works over all browsers.