var rnocache = /rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, rnoshimcache = new RegExp("]", "i"); jQuery.fragments = {}; jQuery.buildFragment = function( args, context, scripts ) { var fragment, cacheable, cachehit, first = args[ 0 ]; // Set context from what may come in as undefined or a jQuery collection or a node // Updated to fix #12266 where accessing context[0] could throw an exception in IE9/10 & // also doubles as fix for #8950 where plain objects caused createDocumentFragment exception // 根据参数context值的不同,确保context为文档根节点document // jQuery1.8.0版本以后代码相对于之前版本有很大改进,以下是改进地方: // 针对context参数值为undefined, jQuery对象,DOM元素节点情况改进代码 // 解决了1.8.0版本中context参数为文档片段(#document-fragment)的bug context = context || document; context = !context.nodeType && context[0] || context; context = context.ownerDocument || context; // Only cache "small" (1/2 KB) HTML strings that are associated with the main document // Cloning options loses the selected state, so don't cache them // IE 6 doesn't like it when you put