Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. define( [
  2. "../core",
  3. "../core/toType",
  4. "../core/isAttached",
  5. "./var/rtagName",
  6. "./var/rscriptType",
  7. "./wrapMap",
  8. "./getAll",
  9. "./setGlobalEval"
  10. ], function( jQuery, toType, isAttached, rtagName, rscriptType, wrapMap, getAll, setGlobalEval ) {
  11. "use strict";
  12. var rhtml = /<|&#?\w+;/;
  13. function buildFragment( elems, context, scripts, selection, ignored ) {
  14. var elem, tmp, tag, wrap, attached, j,
  15. fragment = context.createDocumentFragment(),
  16. nodes = [],
  17. i = 0,
  18. l = elems.length;
  19. for ( ; i < l; i++ ) {
  20. elem = elems[ i ];
  21. if ( elem || elem === 0 ) {
  22. // Add nodes directly
  23. if ( toType( elem ) === "object" ) {
  24. // Support: Android <=4.0 only, PhantomJS 1 only
  25. // push.apply(_, arraylike) throws on ancient WebKit
  26. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  27. // Convert non-html into a text node
  28. } else if ( !rhtml.test( elem ) ) {
  29. nodes.push( context.createTextNode( elem ) );
  30. // Convert html into DOM nodes
  31. } else {
  32. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  33. // Deserialize a standard representation
  34. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  35. wrap = wrapMap[ tag ] || wrapMap._default;
  36. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  37. // Descend through wrappers to the right content
  38. j = wrap[ 0 ];
  39. while ( j-- ) {
  40. tmp = tmp.lastChild;
  41. }
  42. // Support: Android <=4.0 only, PhantomJS 1 only
  43. // push.apply(_, arraylike) throws on ancient WebKit
  44. jQuery.merge( nodes, tmp.childNodes );
  45. // Remember the top-level container
  46. tmp = fragment.firstChild;
  47. // Ensure the created nodes are orphaned (#12392)
  48. tmp.textContent = "";
  49. }
  50. }
  51. }
  52. // Remove wrapper from fragment
  53. fragment.textContent = "";
  54. i = 0;
  55. while ( ( elem = nodes[ i++ ] ) ) {
  56. // Skip elements already in the context collection (trac-4087)
  57. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  58. if ( ignored ) {
  59. ignored.push( elem );
  60. }
  61. continue;
  62. }
  63. attached = isAttached( elem );
  64. // Append to fragment
  65. tmp = getAll( fragment.appendChild( elem ), "script" );
  66. // Preserve script evaluation history
  67. if ( attached ) {
  68. setGlobalEval( tmp );
  69. }
  70. // Capture executables
  71. if ( scripts ) {
  72. j = 0;
  73. while ( ( elem = tmp[ j++ ] ) ) {
  74. if ( rscriptType.test( elem.type || "" ) ) {
  75. scripts.push( elem );
  76. }
  77. }
  78. }
  79. }
  80. return fragment;
  81. }
  82. return buildFragment;
  83. } );