mirror of
https://github.com/jquery/jquery.git
synced 2026-04-20 03:01:22 -04:00
Fix #10863. Allow newlines in JSON data- attributes.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
var rbrace = /^(?:\{.*\}|\[.*\])$/,
|
var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/,
|
||||||
rmultiDash = /([A-Z])/g;
|
rmultiDash = /([A-Z])/g;
|
||||||
|
|
||||||
jQuery.extend({
|
jQuery.extend({
|
||||||
|
|||||||
@@ -646,5 +646,12 @@ test( "Only check element attributes once when calling .data() - #8909", functio
|
|||||||
|
|
||||||
// clean up data cache
|
// clean up data cache
|
||||||
element.remove();
|
element.remove();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test( "JSON data- attributes can have newlines", function() {
|
||||||
|
expect(1);
|
||||||
|
|
||||||
|
var x = jQuery("<div data-some='{\n\"foo\":\n\t\"bar\"\n}'></div>");
|
||||||
|
equal( x.data("some").foo, "bar", "got a JSON data- attribute with spaces" );
|
||||||
|
x.remove();
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user