mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Fix #10863. Allow newlines in JSON data- attributes.
This commit is contained in:
parent
c01e022f33
commit
2263134b22
@ -1,4 +1,4 @@
|
||||
var rbrace = /^(?:\{.*\}|\[.*\])$/,
|
||||
var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/,
|
||||
rmultiDash = /([A-Z])/g;
|
||||
|
||||
jQuery.extend({
|
||||
|
@ -646,5 +646,12 @@ test( "Only check element attributes once when calling .data() - #8909", functio
|
||||
|
||||
// clean up data cache
|
||||
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();
|
||||
});
|
Loading…
Reference in New Issue
Block a user