diff options
Diffstat (limited to 'libs/bower_components/jquery/src/manipulation')
12 files changed, 234 insertions, 71 deletions
diff --git a/libs/bower_components/jquery/src/manipulation/_evalUrl.js b/libs/bower_components/jquery/src/manipulation/_evalUrl.js index 6704749ae3..85ca2c62a4 100644 --- a/libs/bower_components/jquery/src/manipulation/_evalUrl.js +++ b/libs/bower_components/jquery/src/manipulation/_evalUrl.js @@ -1,18 +1,20 @@ -define([ +define( [ "../ajax" ], function( jQuery ) { jQuery._evalUrl = function( url ) { - return jQuery.ajax({ + return jQuery.ajax( { url: url, + + // Make this explicit, since user can override this through ajaxSetup (#11264) type: "GET", dataType: "script", async: false, global: false, "throws": true - }); + } ); }; return jQuery._evalUrl; -}); +} ); diff --git a/libs/bower_components/jquery/src/manipulation/buildFragment.js b/libs/bower_components/jquery/src/manipulation/buildFragment.js new file mode 100644 index 0000000000..cfdd1c0e67 --- /dev/null +++ b/libs/bower_components/jquery/src/manipulation/buildFragment.js @@ -0,0 +1,102 @@ +define( [ + "../core", + "./var/rtagName", + "./var/rscriptType", + "./wrapMap", + "./getAll", + "./setGlobalEval" +], function( jQuery, rtagName, rscriptType, wrapMap, getAll, setGlobalEval ) { + +var rhtml = /<|&#?\w+;/; + +function buildFragment( elems, context, scripts, selection, ignored ) { + var elem, tmp, tag, wrap, contains, j, + fragment = context.createDocumentFragment(), + nodes = [], + i = 0, + l = elems.length; + + for ( ; i < l; i++ ) { + elem = elems[ i ]; + + if ( elem || elem === 0 ) { + + // Add nodes directly + if ( jQuery.type( elem ) === "object" ) { + + // Support: Android<4.1, PhantomJS<2 + // push.apply(_, arraylike) throws on ancient WebKit + jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); + + // Convert non-html into a text node + } else if ( !rhtml.test( elem ) ) { + nodes.push( context.createTextNode( elem ) ); + + // Convert html into DOM nodes + } else { + tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); + + // Deserialize a standard representation + tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); + wrap = wrapMap[ tag ] || wrapMap._default; + tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; + + // Descend through wrappers to the right content + j = wrap[ 0 ]; + while ( j-- ) { + tmp = tmp.lastChild; + } + + // Support: Android<4.1, PhantomJS<2 + // push.apply(_, arraylike) throws on ancient WebKit + jQuery.merge( nodes, tmp.childNodes ); + + // Remember the top-level container + tmp = fragment.firstChild; + + // Ensure the created nodes are orphaned (#12392) + tmp.textContent = ""; + } + } + } + + // Remove wrapper from fragment + fragment.textContent = ""; + + i = 0; + while ( ( elem = nodes[ i++ ] ) ) { + + // Skip elements already in the context collection (trac-4087) + if ( selection && jQuery.inArray( elem, selection ) > -1 ) { + if ( ignored ) { + ignored.push( elem ); + } + continue; + } + + contains = jQuery.contains( elem.ownerDocument, elem ); + + // Append to fragment + tmp = getAll( fragment.appendChild( elem ), "script" ); + + // Preserve script evaluation history + if ( contains ) { + setGlobalEval( tmp ); + } + + // Capture executables + if ( scripts ) { + j = 0; + while ( ( elem = tmp[ j++ ] ) ) { + if ( rscriptType.test( elem.type || "" ) ) { + scripts.push( elem ); + } + } + } + } + + return fragment; +} + +return buildFragment; +} ); diff --git a/libs/bower_components/jquery/src/manipulation/createSafeFragment.js b/libs/bower_components/jquery/src/manipulation/createSafeFragment.js new file mode 100644 index 0000000000..5b766d4358 --- /dev/null +++ b/libs/bower_components/jquery/src/manipulation/createSafeFragment.js @@ -0,0 +1,20 @@ +define( [ + "./var/nodeNames" +], function( nodeNames ) { + +function createSafeFragment( document ) { + var list = nodeNames.split( "|" ), + safeFrag = document.createDocumentFragment(); + + if ( safeFrag.createElement ) { + while ( list.length ) { + safeFrag.createElement( + list.pop() + ); + } + } + return safeFrag; +} + +return createSafeFragment; +} ); diff --git a/libs/bower_components/jquery/src/manipulation/getAll.js b/libs/bower_components/jquery/src/manipulation/getAll.js new file mode 100644 index 0000000000..cc913f29ee --- /dev/null +++ b/libs/bower_components/jquery/src/manipulation/getAll.js @@ -0,0 +1,21 @@ +define( [ + "../core" +], function( jQuery ) { + +function getAll( context, tag ) { + + // Support: IE9-11+ + // Use typeof to avoid zero-argument method invocation on host objects (#15151) + var ret = typeof context.getElementsByTagName !== "undefined" ? + context.getElementsByTagName( tag || "*" ) : + typeof context.querySelectorAll !== "undefined" ? + context.querySelectorAll( tag || "*" ) : + []; + + return tag === undefined || tag && jQuery.nodeName( context, tag ) ? + jQuery.merge( [ context ], ret ) : + ret; +} + +return getAll; +} ); diff --git a/libs/bower_components/jquery/src/manipulation/setGlobalEval.js b/libs/bower_components/jquery/src/manipulation/setGlobalEval.js new file mode 100644 index 0000000000..8ca69a03ad --- /dev/null +++ b/libs/bower_components/jquery/src/manipulation/setGlobalEval.js @@ -0,0 +1,20 @@ +define( [ + "../data/var/dataPriv" +], function( dataPriv ) { + +// Mark scripts as having already been evaluated +function setGlobalEval( elems, refElements ) { + var i = 0, + l = elems.length; + + for ( ; i < l; i++ ) { + dataPriv.set( + elems[ i ], + "globalEval", + !refElements || dataPriv.get( refElements[ i ], "globalEval" ) + ); + } +} + +return setGlobalEval; +} ); diff --git a/libs/bower_components/jquery/src/manipulation/support.js b/libs/bower_components/jquery/src/manipulation/support.js index 2567d7e702..cd4081ebb2 100644 --- a/libs/bower_components/jquery/src/manipulation/support.js +++ b/libs/bower_components/jquery/src/manipulation/support.js @@ -1,76 +1,33 @@ -define([ +define( [ + "../var/document", "../var/support" -], function( support ) { +], function( document, support ) { -(function() { - // Minified: var a,b,c - var input = document.createElement( "input" ), - div = document.createElement( "div" ), - fragment = document.createDocumentFragment(); +( function() { + var fragment = document.createDocumentFragment(), + div = fragment.appendChild( document.createElement( "div" ) ), + input = document.createElement( "input" ); - // Setup - div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; + // Support: Android 4.0-4.3, Safari<=5.1 + // Check state lost if the name is set (#11217) + // Support: Windows Web Apps (WWA) + // `name` and `type` must use .setAttribute for WWA (#14901) + input.setAttribute( "type", "radio" ); + input.setAttribute( "checked", "checked" ); + input.setAttribute( "name", "t" ); - // IE strips leading whitespace when .innerHTML is used - support.leadingWhitespace = div.firstChild.nodeType === 3; + div.appendChild( input ); - // Make sure that tbody elements aren't automatically inserted - // IE will insert them into empty tables - support.tbody = !div.getElementsByTagName( "tbody" ).length; - - // Make sure that link elements get serialized correctly by innerHTML - // This requires a wrapper element in IE - support.htmlSerialize = !!div.getElementsByTagName( "link" ).length; - - // Makes sure cloning an html5 element does not cause problems - // Where outerHTML is undefined, this still works - support.html5Clone = - document.createElement( "nav" ).cloneNode( true ).outerHTML !== "<:nav></:nav>"; - - // Check if a disconnected checkbox will retain its checked - // value of true after appended to the DOM (IE6/7) - input.type = "checkbox"; - input.checked = true; - fragment.appendChild( input ); - support.appendChecked = input.checked; + // Support: Safari<=5.1, Android<4.2 + // Older WebKit doesn't clone checked state correctly in fragments + support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; + // Support: IE<=11+ // Make sure textarea (and checkbox) defaultValue is properly cloned - // Support: IE6-IE11+ div.innerHTML = "<textarea>x</textarea>"; support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; - - // #11217 - WebKit loses check when the name is after the checked attribute - fragment.appendChild( div ); - div.innerHTML = "<input type='radio' checked='checked' name='t'/>"; - - // Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3 - // old WebKit doesn't clone checked state correctly in fragments - support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; - - // Support: IE<9 - // Opera does not clone events (and typeof div.attachEvent === undefined). - // IE9-10 clones events bound via attachEvent, but they don't trigger with .click() - support.noCloneEvent = true; - if ( div.attachEvent ) { - div.attachEvent( "onclick", function() { - support.noCloneEvent = false; - }); - - div.cloneNode( true ).click(); - } - - // Execute the test only if not already executed in another module. - if (support.deleteExpando == null) { - // Support: IE<9 - support.deleteExpando = true; - try { - delete div.test; - } catch( e ) { - support.deleteExpando = false; - } - } -})(); +} )(); return support; -}); +} ); diff --git a/libs/bower_components/jquery/src/manipulation/var/nodeNames.js b/libs/bower_components/jquery/src/manipulation/var/nodeNames.js new file mode 100644 index 0000000000..05bb604f47 --- /dev/null +++ b/libs/bower_components/jquery/src/manipulation/var/nodeNames.js @@ -0,0 +1,5 @@ +define( function() { + return "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"; +} ); diff --git a/libs/bower_components/jquery/src/manipulation/var/rcheckableType.js b/libs/bower_components/jquery/src/manipulation/var/rcheckableType.js index c27a15dc47..4c95394ac0 100644 --- a/libs/bower_components/jquery/src/manipulation/var/rcheckableType.js +++ b/libs/bower_components/jquery/src/manipulation/var/rcheckableType.js @@ -1,3 +1,3 @@ -define(function() { - return (/^(?:checkbox|radio)$/i); -}); +define( function() { + return ( /^(?:checkbox|radio)$/i ); +} ); diff --git a/libs/bower_components/jquery/src/manipulation/var/rleadingWhitespace.js b/libs/bower_components/jquery/src/manipulation/var/rleadingWhitespace.js new file mode 100644 index 0000000000..96ef95f311 --- /dev/null +++ b/libs/bower_components/jquery/src/manipulation/var/rleadingWhitespace.js @@ -0,0 +1,3 @@ +define( function() { + return ( /^\s+/ ); +} ); diff --git a/libs/bower_components/jquery/src/manipulation/var/rscriptType.js b/libs/bower_components/jquery/src/manipulation/var/rscriptType.js new file mode 100644 index 0000000000..0c77c8a583 --- /dev/null +++ b/libs/bower_components/jquery/src/manipulation/var/rscriptType.js @@ -0,0 +1,3 @@ +define( function() { + return ( /^$|\/(?:java|ecma)script/i ); +} ); diff --git a/libs/bower_components/jquery/src/manipulation/var/rtagName.js b/libs/bower_components/jquery/src/manipulation/var/rtagName.js new file mode 100644 index 0000000000..9e542694a7 --- /dev/null +++ b/libs/bower_components/jquery/src/manipulation/var/rtagName.js @@ -0,0 +1,3 @@ +define( function() { + return ( /<([\w:-]+)/ ); +} ); diff --git a/libs/bower_components/jquery/src/manipulation/wrapMap.js b/libs/bower_components/jquery/src/manipulation/wrapMap.js new file mode 100644 index 0000000000..fdb430a03b --- /dev/null +++ b/libs/bower_components/jquery/src/manipulation/wrapMap.js @@ -0,0 +1,27 @@ +define( function() { + +// We have to close these tags to support XHTML (#13200) +var wrapMap = { + + // Support: IE9 + option: [ 1, "<select multiple='multiple'>", "</select>" ], + + // XHTML parsers do not magically insert elements in the + // same way that tag soup parsers do. So we cannot shorten + // this by omitting <tbody> or other required elements. + thead: [ 1, "<table>", "</table>" ], + col: [ 2, "<table><colgroup>", "</colgroup></table>" ], + tr: [ 2, "<table><tbody>", "</tbody></table>" ], + td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], + + _default: [ 0, "", "" ] +}; + +// Support: IE9 +wrapMap.optgroup = wrapMap.option; + +wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; +wrapMap.th = wrapMap.td; + +return wrapMap; +} ); |