Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions jquery.esi.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@
// Retrieve the base DOM element, in order to access the DOM method
// getElementsByTagName.
base_element = $(this).get(0);
// Discover comment-wrapped <esi:include> tags and move them out of the comment.
jQuery("*:not(iframe)").contents()
.filter(function(){ return this.nodeType == 8 && this.nodeValue.match(/^esi/);})
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the value 8 has a corresponding named constant COMMENT_NODE ( see http://www.w3schools.com/jsref/prop_node_nodetype.asp ). Could you check if the constant also works correctly in your use-case?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately it does not. I tried it in Chromium 29.0.1547.65 (Ubuntu 13.10) and Firefox 24.0.

.each(function(){
var dom = $.trim(this.nodeValue).replace(/^esi/,'').trim();
$(this).after(dom);
$(this).remove();
});
// Discover the <esi:include> tags.
jQuery.each(base_element.getElementsByTagName('esi:include'), function(i, val) {
// Some DOMs fail to recognise that the ESI include tag is self-
Expand Down