Skip to content

Instantly share code, notes, and snippets.

@arlolra
Created January 13, 2015 20:44
Show Gist options
  • Save arlolra/de4bc8fcff713ca6e705 to your computer and use it in GitHub Desktop.
Save arlolra/de4bc8fcff713ca6e705 to your computer and use it in GitHub Desktop.
diff --git a/lib/ext.core.AttributeExpander.js b/lib/ext.core.AttributeExpander.js
index c0bdc53..c53f49f 100644
--- a/lib/ext.core.AttributeExpander.js
+++ b/lib/ext.core.AttributeExpander.js
@@ -19,13 +19,11 @@ var KV = defines.KV,
* transclusions, etc. and returns the content.
* ---------------------------------------------------------- */
function stripMetaTags( tokens, wrapTemplates ) {
- var isPushed = false, buf = [],
- hasGeneratedContent = false;
+ var buf = [], hasGeneratedContent = false;
for (var i = 0, l = tokens.length; i < l; i++) {
var token = tokens[i];
- if ([TagTk, SelfclosingTagTk].indexOf(token.constructor) !== -1) {
- isPushed = false;
+ if ( token.constructor === SelfclosingTagTk && token.name === "meta" ) {
// Strip all meta tags.
if (wrapTemplates) {
// If we are in wrap-template mode, extract info from the meta-tag
@@ -35,19 +33,11 @@ function stripMetaTags( tokens, wrapTemplates ) {
if (!typeMatch[1].match(/\/End$/)) {
hasGeneratedContent = true;
}
- } else {
- isPushed = true;
- buf.push(token);
+ continue;
}
}
-
- if (!isPushed && token.name !== "meta") {
- // Dont strip token if it is not a meta-tag
- buf.push(token);
- }
- } else {
- buf.push(token);
}
+ buf.push(token);
}
return { hasGeneratedContent: hasGeneratedContent, value: buf };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment