Created
August 7, 2013 08:03
-
-
Save 6174/6172142 to your computer and use it in GitHub Desktop.
判断元素节点是否还在dom中
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//from api | |
document.contains(someReferenceToADomElement); | |
//from job | |
var elementInDocument = function(element) { | |
while (element = element.parentNode) { | |
if (element == document) { | |
return true; | |
} | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment