From bd738ddf5fc2281b8172aacec7feaba76749f13d Mon Sep 17 00:00:00 2001 From: Damyon Wiese Date: Wed, 30 Sep 2015 12:52:13 +0800 Subject: [PATCH] MDL-51529 libraries: Upgrade html5shiv to 3.7.3 --- theme/bootstrapbase/javascript/html5shiv.js | 45 ++++++++++++++++----- theme/bootstrapbase/thirdpartylibs.xml | 2 +- theme/bootstrapbase/upgrade.txt | 3 ++ 3 files changed, 39 insertions(+), 11 deletions(-) diff --git a/theme/bootstrapbase/javascript/html5shiv.js b/theme/bootstrapbase/javascript/html5shiv.js index 4875fbb2f4d..45ea723dd58 100644 --- a/theme/bootstrapbase/javascript/html5shiv.js +++ b/theme/bootstrapbase/javascript/html5shiv.js @@ -1,10 +1,10 @@ /** -* @preserve HTML5 Shiv v3.6.2 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed +* @preserve HTML5 Shiv 3.7.3 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed */ ;(function(window, document) { /*jshint evil:true */ /** version */ - var version = '3.6.2'; + var version = '3.7.3'; /** Preset options */ var options = window.html5 || {}; @@ -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. @@ -103,7 +121,7 @@ * returns a shived element for the given nodeName and document * @memberOf html5 * @param {String} nodeName name of the element - * @param {Document} ownerDocument The context document. + * @param {Document|DocumentFragment} ownerDocument The context document. * @returns {Object} The shived element. */ function createElement(nodeName, ownerDocument, data){ @@ -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; } /** @@ -187,7 +205,7 @@ 'var n=f.cloneNode(),c=n.createElement;' + 'h.shivMethods&&(' + // unroll the `createElement` calls - getElements().join().replace(/\w+/g, function(nodeName) { + getElements().join().replace(/[\w\-:]+/g, function(nodeName) { data.createElem(nodeName); data.frag.createElement(nodeName); return 'c("' + nodeName + '")'; @@ -213,7 +231,7 @@ if (html5.shivCSS && !supportsHtml5Styles && !data.hasCSS) { data.hasCSS = !!addStyleSheet(ownerDocument, // corrects block display not defined in IE6/7/8/9 - 'article,aside,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}' + + 'article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}' + // adds styling not present in IE6/7/8/9 'mark{background:#FF0;color:#000}' + // hides non-rendered elements @@ -244,7 +262,7 @@ * @memberOf html5 * @type Array|String */ - 'elements': options.elements || 'abbr article aside audio bdi canvas data datalist details 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 @@ -287,7 +305,10 @@ createElement: createElement, //creates a shived documentFragment - createDocumentFragment: createDocumentFragment + createDocumentFragment: createDocumentFragment, + + //extends list of elements + addElements: addElements }; /*--------------------------------------------------------------------------*/ @@ -298,4 +319,8 @@ // shiv the document shivDocument(document); -}(this, document)); + if(typeof module == 'object' && module.exports){ + module.exports = html5; + } + +}(typeof window !== "undefined" ? window : this, document)); diff --git a/theme/bootstrapbase/thirdpartylibs.xml b/theme/bootstrapbase/thirdpartylibs.xml index bfbf0e48492..57c10ed7e8c 100644 --- a/theme/bootstrapbase/thirdpartylibs.xml +++ b/theme/bootstrapbase/thirdpartylibs.xml @@ -11,7 +11,7 @@ javascript/html5shiv.js Html5Shiv Apache - 3.6.2 + 3.7.3 2.0 diff --git a/theme/bootstrapbase/upgrade.txt b/theme/bootstrapbase/upgrade.txt index ceb6e51715a..3c6a47a468d 100644 --- a/theme/bootstrapbase/upgrade.txt +++ b/theme/bootstrapbase/upgrade.txt @@ -1,6 +1,9 @@ This file describes API changes in /theme/bootstrapbase information provided here is intended especially for theme designers. +=== 3.0 === +* html5shiv updated to 3.7.3 + === 2.6 === Notes: * File theme/bootstrapbase/less/moodle/grade.less is removed. Corrections are