Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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>.
  • Loading branch information...
commit d52158c36f81480900b76c5d71fc1b5caf0cfeb4 1 parent cf46806
@espadrine espadrine authored
View
2  src/repl/commandtransformer.js
@@ -254,7 +254,7 @@ cls.HostCommandTransformer = function() {
{
if (this.is_global_call(tokenlist, index))
token[VALUE] = "(typeof $ == 'function' && $ || \
- function(e) { return document.getElementById(e); })";
+ function(e) { return document.querySelector(e); })";
};
this._hostcommands.$$ = function(token, tokenlist, index)
View
10 tests/commandtransformer.qunit.html
@@ -76,11 +76,11 @@
test("$", function() {
equal(transform("$"), "$");
- equal(transform("$(foo)"), "document.getElementById(foo)");
- equal(transform("var x=$(foo)"), "var x=document.getElementById(foo)");
- equal(transform("var x= $(foo)"), "var x= document.getElementById(foo)");
- equal(transform("var x =$(foo)"), "var x =document.getElementById(foo)");
- equal(transform("var x = $(foo)"), "var x = document.getElementById(foo)");
+ equal(transform("$(foo)"), "document.querySelector(foo)");
+ equal(transform("var x=$(foo)"), "var x=document.querySelector(foo)");
+ equal(transform("var x= $(foo)"), "var x= document.querySelector(foo)");
+ equal(transform("var x =$(foo)"), "var x =document.querySelector(foo)");
+ equal(transform("var x = $(foo)"), "var x = document.querySelector(foo)");
});
Please sign in to comment.
Something went wrong with that request. Please try again.