Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions jquery-migrate.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* jQuery Migrate - v1.2.0 - 2013-05-01
* jQuery Migrate - v1.2.1 - 2013-05-08
* https://github.com/jquery/jquery-migrate
* Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors; Licensed MIT
*/
Expand Down Expand Up @@ -190,26 +190,25 @@ jQuery.attrHooks.value = {
var matched, browser,
oldInit = jQuery.fn.init,
oldParseJSON = jQuery.parseJSON,
rignoreText = /^[^<]*(.*?)[^>]*$/,
// Note this does NOT include the #9521 XSS fix from 1.7!
rquickExpr = /^[^<]*<[\w\W]+>[^>]*$/;
// Note: XSS check is done below after string is trimmed
rquickExpr = /^([^<]*)(<[\w\W]+>)([^>]*)$/;

// $(html) "looks like html" rule change
jQuery.fn.init = function( selector, context, rootjQuery ) {
var match;

if ( selector && typeof selector === "string" && !jQuery.isPlainObject( context ) &&
(match = rquickExpr.exec( selector )) && match[0] ) {
(match = rquickExpr.exec( jQuery.trim( selector ) )) && match[ 0 ] ) {
// This is an HTML string according to the "old" rules; is it still?
if ( selector.charAt( 0 ) !== "<" ) {
migrateWarn("$(html) HTML strings must start with '<' character");
}
if ( selector.charAt( selector.length -1 ) !== ">" ) {
if ( match[ 3 ] ) {
migrateWarn("$(html) HTML text after last tag is ignored");
}
// Consistently reject any HTML-like string starting with a hash (#9521)
// Note that this may break jQuery 1.6.x code that otherwise would work.
if ( jQuery.trim( selector ).charAt( 0 ) === "#" ) {
if ( match[ 0 ].charAt( 0 ) === "#" ) {
migrateWarn("HTML string cannot start with a '#' character");
jQuery.error("JQMIGRATE: Invalid selector string (XSS)");
}
Expand All @@ -219,8 +218,7 @@ jQuery.fn.init = function( selector, context, rootjQuery ) {
context = context.context;
}
if ( jQuery.parseHTML ) {
match = rignoreText.exec( selector );
return oldInit.call( this, jQuery.parseHTML( match[1] || selector, context, true ),
return oldInit.call( this, jQuery.parseHTML( match[ 2 ], context, true ),
context, rootjQuery );
}
}
Expand Down
4 changes: 2 additions & 2 deletions jquery-migrate.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.