Skip to content

Commit

Permalink
Merge pull request #970 from bitovi/update-html5shiv
Browse files Browse the repository at this point in the history
Upgrading html5shiv to 3.7.2
  • Loading branch information
Curtis Cummings committed May 16, 2014
2 parents ac2e288 + 9365e76 commit f8775f0
Showing 1 changed file with 29 additions and 8 deletions.
37 changes: 29 additions & 8 deletions lib/html5shiv.js
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/**
* @preserve HTML5 Shiv v3.6.2 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
* @preserve HTML5 Shiv 3.7.2 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
*/
;(function(window, document) {
/*jshint evil:true */
/** version */
var version = '3.6.2 - CanJS Mod';
var version = '3.7.2';

/** Preset options */
var options = window.html5 || {};
Expand Down Expand Up @@ -82,7 +82,25 @@
return typeof elements == 'string' ? elements.split(' ') : elements;
}

/**
/**
* Extends the built-in list of html5 elements
* @memberOf html5
* @param {String|Array} newElements whitespace separated list or array of new element names to shiv
* @param {Document} ownerDocument The context document.
*/
function addElements(newElements, ownerDocument) {
var elements = html5.elements;
if(typeof elements != 'string'){
elements = elements.join(' ');
}
if(typeof newElements != 'string'){
newElements = newElements.join(' ');
}
html5.elements = elements +' '+ newElements;
shivDocument(ownerDocument);
}

/**
* Returns the data associated to the given document
* @private
* @param {Document} ownerDocument The document.
Expand Down Expand Up @@ -133,7 +151,7 @@
// a 403 response, will cause the tab/window to crash
// * Script elements appended to fragments will execute when their `src`
// or `text` property is set
return node.canHaveChildren && !reSkip.test(nodeName) ? data.frag.appendChild(node) : node;
return node.canHaveChildren && !reSkip.test(nodeName) && !node.tagUrn ? data.frag.appendChild(node) : node;
}

/**
Expand Down Expand Up @@ -187,7 +205,7 @@
'var n=f.cloneNode(),c=n.createElement;' +
'h.shivMethods&&(' +
// unroll the `createElement` calls
getElements().join().replace(/([\w\-]|[\w\:])+/g, function(nodeName) {
getElements().join().replace(/[\w\-:]+/g, function(nodeName) {
data.createElem(nodeName);
data.frag.createElement(nodeName);
return 'c("' + nodeName + '")';
Expand Down Expand Up @@ -244,7 +262,7 @@
* @memberOf html5
* @type Array|String
*/
'elements': options.elements || 'abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video',
'elements': options.elements || 'abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video',

/**
* current version of html5shiv
Expand Down Expand Up @@ -287,7 +305,10 @@
createElement: createElement,

//creates a shived documentFragment
createDocumentFragment: createDocumentFragment
createDocumentFragment: createDocumentFragment,

//extends list of elements
addElements: addElements
};

/*--------------------------------------------------------------------------*/
Expand All @@ -298,4 +319,4 @@
// shiv the document
shivDocument(document);

}(this, document));
}(this, document));

0 comments on commit f8775f0

Please sign in to comment.