Skip to content

Commit d52158c

Browse files
committed
Change console host command: $ → querySelector
This comes from a change to Firebug's Command Line API <http://getfirebug.com/wiki/index.php/Command_Line_API>.
1 parent cf46806 commit d52158c

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/repl/commandtransformer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ cls.HostCommandTransformer = function() {
254254
{
255255
if (this.is_global_call(tokenlist, index))
256256
token[VALUE] = "(typeof $ == 'function' && $ || \
257-
function(e) { return document.getElementById(e); })";
257+
function(e) { return document.querySelector(e); })";
258258
};
259259

260260
this._hostcommands.$$ = function(token, tokenlist, index)

tests/commandtransformer.qunit.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@
7676

7777
test("$", function() {
7878
equal(transform("$"), "$");
79-
equal(transform("$(foo)"), "document.getElementById(foo)");
80-
equal(transform("var x=$(foo)"), "var x=document.getElementById(foo)");
81-
equal(transform("var x= $(foo)"), "var x= document.getElementById(foo)");
82-
equal(transform("var x =$(foo)"), "var x =document.getElementById(foo)");
83-
equal(transform("var x = $(foo)"), "var x = document.getElementById(foo)");
79+
equal(transform("$(foo)"), "document.querySelector(foo)");
80+
equal(transform("var x=$(foo)"), "var x=document.querySelector(foo)");
81+
equal(transform("var x= $(foo)"), "var x= document.querySelector(foo)");
82+
equal(transform("var x =$(foo)"), "var x =document.querySelector(foo)");
83+
equal(transform("var x = $(foo)"), "var x = document.querySelector(foo)");
8484

8585
});
8686

0 commit comments

Comments
 (0)