Created
February 25, 2009 16:06
-
-
Save simonw/70248 to your computer and use it in GitHub Desktop.
jQuery methods for accessing HTML comments and comment text. Only tested in Safari.
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
/* jQuery methods for accessing HTML comments and comment text | |
Only tested in Safari. */ | |
jQuery.fn.comments = function() { | |
return this.contents().filter(function() { | |
return this.nodeType == 8; | |
}) | |
}; | |
jQuery.fn.commentText = function() { | |
var s = []; | |
this.comments().each(function() { | |
s[s.length] = this.nodeValue; | |
}); | |
return s.join(''); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment