prototype: Prevent an error being thrown by $$ when #id does not exist in $$("div #id"). Closes #8325.
This commit is contained in:
parent
a7a0edd830
commit
beeb12e7dd
@ -1,5 +1,7 @@
|
||||
*SVN*
|
||||
|
||||
* Prevent an error being thrown by $$ when #id does not exist in $$("div #id"). Closes #8325. [Tobie Langel, ecke]
|
||||
|
||||
* Make Prototype.ScriptFragment behave when including Prototype inline. [Christophe Porteneuve]
|
||||
|
||||
* Deprecate Position (kept for backwards compatibility). Add Element#cumulativeOffset, Element#positionedOffset, Element#absolutize, Element#relativize, Element#cumulativeScrollOffset, Element#getOffsetParent, Element#viewportOffset and Element#clonePosition. [Christophe Porteneuve]
|
||||
|
@ -339,7 +339,8 @@ Object.extend(Selector, {
|
||||
|
||||
id: function(nodes, root, id, combinator) {
|
||||
var targetNode = $(id), h = Selector.handlers;
|
||||
if (!nodes && root == document) return targetNode ? [targetNode] : [];
|
||||
if (!targetNode) return [];
|
||||
if (!nodes && root == document) return [targetNode];
|
||||
if (nodes) {
|
||||
if (combinator) {
|
||||
if (combinator == 'child') {
|
||||
|
@ -219,6 +219,7 @@
|
||||
assertEnumEqual($('level2_1', 'level2_2'), $$('#level1>span'));
|
||||
assertEnumEqual($('level2_1', 'level2_2'), $$('#level1 > span'));
|
||||
assertEnumEqual($('level3_1', 'level3_2'), $$('#level2_1 > *'));
|
||||
assertEnumEqual([], $$('div > #nonexistent'));
|
||||
$RunBenchmarks && wait(500, function() {
|
||||
benchmark(function() { $$('#level1 > span') }, 1000);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user