Proper fix (and unit tests) for selector escaping issue.
This commit is contained in:
parent
f4570f39d7
commit
059ce21040
|
@ -170,7 +170,7 @@ var Selector = Class.create({
|
|||
if (root !== document) {
|
||||
var oldId = root.id, id = $(root).identify();
|
||||
// Escape special characters in the ID.
|
||||
id = id.replace(/[\.:]/g, "\\$1");
|
||||
id = id.replace(/([\.:])/g, "\\$1");
|
||||
e = "#" + id + " " + e;
|
||||
}
|
||||
|
||||
|
|
|
@ -53,6 +53,17 @@
|
|||
</span>
|
||||
</span>
|
||||
</div> <!-- #dupContainer -->
|
||||
<div id="dupContainer.withdot:active">
|
||||
<span id="dupL1_dotcolon" class="span_foo span_bar">
|
||||
<span id="dupL2_dotcolon">
|
||||
<span id="dupL3_dotcolon">
|
||||
<span id="dupL4_dotcolon">
|
||||
<span id="dupL5_dotcolon"></span>
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
</div> <!-- #dupContainer.withdot:active -->
|
||||
|
||||
<div id="grandfather"> grandfather
|
||||
<div id="father" class="brothers men"> father
|
||||
|
|
|
@ -397,6 +397,14 @@ new Test.Unit.Runner({
|
|||
|
||||
this.assertEqual(a, b);
|
||||
},
|
||||
testElementDownWithDotAndColon: function() {
|
||||
var a = $('dupL4_dotcolon');
|
||||
var b = $('dupContainer.withdot:active').down('#dupL4_dotcolon');
|
||||
var c = $('dupContainer.withdot:active').select('#dupL4_dotcolon');
|
||||
|
||||
this.assertEqual(a, b);
|
||||
this.assertEnumEqual([a], c);
|
||||
},
|
||||
|
||||
testDescendantSelectorBuggy: function() {
|
||||
var el = document.createElement('div');
|
||||
|
|
Loading…
Reference in New Issue