Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #46 from sroussey/issue-5764

Issue 5764
  • Loading branch information...
commit 7579ab2475138688ebddab05653fb9073db9eef2 2 parents 62cfb15 + 0f8b98d
@janodvarko janodvarko authored
View
4 extension/content/firebug/chrome/reps.js
@@ -701,7 +701,6 @@ FirebugReps.Arr = domplate(Firebug.Rep,
},
// http://code.google.com/p/fbug/issues/detail?id=874
- // BEGIN Yahoo BSD Source (modified here) YAHOO.lang.isArray, YUI 2.2.2 June 2007
isArray: function(obj, win)
{
win = win || window;
@@ -746,8 +745,7 @@ FirebugReps.Arr = domplate(Firebug.Rep,
return false;
},
- // END Yahoo BSD SOURCE See license below.
-
+
getTitle: function(object, context)
{
return "[" + object.length + "]";
View
32 extension/content/firebug/console/commandLine.js
@@ -1049,14 +1049,38 @@ Firebug.CommandLine.CommandHandler = Obj.extend(Object,
function FirebugCommandLineAPI(context)
{
- this.$ = function(id) // returns unwrapped elements from the page
+ this.$ = function(selector, start) // returns unwrapped elements from the page
{
- return Wrapper.unwrapObject(context.baseWindow.document).getElementById(id);
+ var result;
+ if (start && start.querySelector && (
+ start.nodeType == Node.ELEMENT_NODE ||
+ start.nodeType == Node.DOCUMENT_NODE ||
+ start.nodeType == Node.DOCUMENT_FRAGMENT_NODE)) {
+ return start.querySelector(selector);
+ }
+
+ result = context.baseWindow.document.querySelector(selector);
+ if (result == null && (selector||"")[0] !== "#")
+ {
+ if (context.baseWindow.document.getElementById(selector))
+ {
+ // This should be removed in the next minor (non-bugfix) version
+ var msg = Locale.$STRF("warning.dollar_change", [selector]);
+ Firebug.Console.log(msg, context, "warn");
+ result = null;
+ }
+ }
+ return result;
};
- this.$$ = function(selector) // returns unwrapped elements from the page
+ this.$$ = function(selector, start) // returns unwrapped elements from the page
{
- var result = Wrapper.unwrapObject(context.baseWindow.document).querySelectorAll(selector);
+ var result;
+ if (start && start.querySelectorAll && (start.nodeType == Node.ELEMENT_NODE || start.nodeType == Node.DOCUMENT_NODE || start.nodeType == Node.DOCUMENT_FRAGMENT_NODE)) {
+ result = start.querySelectorAll(selector);
+ }
+ else
+ result = context.baseWindow.document.querySelectorAll(selector);
return Arr.cloneArray(result);
};
View
1  extension/locale/en-US/firebug.properties
@@ -1367,6 +1367,7 @@ confirmation.Edit_CSS_Source=Your existing CSS edits will be discarded.\nAre you
# Console messages
warning.Console_must_be_enabled=Console must be enabled
warning.Command_line_blocked?=Command line blocked?
+warning.dollar_change=The console command line function $() has changed meaning from $=getElementById(id) to $=querySelector(selector). You might try $("#%S") instead.
message.Reload_to_activate_window_console=Reload to activate window console
# LOCALIZATION NOTE (message.sourceNotAvailableFor, message.The_resource_from_this_URL_is_not_text):
View
4 tests/content/commandLine/4391/issue4391.html
@@ -16,11 +16,11 @@
<ol>
<li>Open Firebug and enable the Console panel.</li>
-<li>Type following in to the command line: <code style="color:green">$("testElement")</code></li>
+<li>Type following in to the command line: <code style="color:green">$("#testElement")</code></li>
<li>Press Enter</li>
<li>The result should be:
<pre>
->>> $("testElement")
+>>> $("#testElement")
&ltdiv id="testElement"&gt
</pre>
<li>Load jQuery by clicking this button:
View
4 tests/content/commandLine/api/api.html
@@ -19,11 +19,11 @@
<i>'expression' -> 'result'</i>
</li>
<ol>
- <li><code>$("test1") -> &lt;div id="test1"&gt;</code></li>
+ <li><code>$("#test1") -> &lt;div id="test1"&gt;</code></li>
<li><code>$$(".a.c") -> [div.a, div.a]</code></li>
<li><code>$x("html/body/span/div[1]") -> [div.test]</code></li>
<li><code>dir(a) -> a: 10</code></li>
- <li><code>dirxml($('test3')) -> &lt;div id="test3"&gt;&lt;div&gt;&lt;/div&gt;&lt;/div&gt;</code></li>
+ <li><code>dirxml($('#test3')) -> &lt;div id="test3"&gt;&lt;div&gt;&lt;/div&gt;&lt;/div&gt;</code></li>
<li><code>keys(b) -> ["a", "name"]</code></li>
<li><code>values(b) -> [7, "a"]</code></li>
<li><code>table(a) -> Object Properties: 10 (tabular output)</code></li>
View
4 tests/content/commandLine/api/api.js
@@ -15,7 +15,7 @@ function runTest()
// parameters.
// \u00A0 == &nbsp; == #160 -> used by nodeTag domplate.
- tasks.push(executeAndVerify, "$(\"test1\")", "<div\u00A0id=\"test1\">",
+ tasks.push(executeAndVerify, "$(\"#test1\")", "<div\u00A0id=\"test1\">",
"a", "objectLink objectLink-element");
tasks.push(executeAndVerify, "$$(\".a.c\")", "[div.a, div.a]",
@@ -27,7 +27,7 @@ function runTest()
tasks.push(executeAndVerify, "dir(a)", /\s*a\s*10\s*/,
"table", "domTable");
- tasks.push(executeAndVerify, "dirxml($('test3'))",
+ tasks.push(executeAndVerify, "dirxml($('#test3'))",
"<div\u00A0id=\"test3\"><div></div></div>",
"div", "logRow logRow-dirxml");
View
2  tests/content/commandLine/api/cd.html
@@ -20,7 +20,7 @@
</li>
<ol>
<li><code>cd(frames[0]) -> "Current window:", Window cdFrame.html]</code></li>
- <li><code>$("test-iframe-1") -> &lt;div id="test-iframe-1"&gt;</code></li>
+ <li><code>$("#test-iframe-1") -> &lt;div id="test-iframe-1"&gt;</code></li>
<li><code>cd(top) -> ["Current window:", Window cd.html]</code></li>
</ol>
</ol>
View
2  tests/content/commandLine/api/cd.js
@@ -13,7 +13,7 @@ function runTest()
"[\"Current window:\", Window cdFrame.html]",
"pre", "objectBox objectBox-array");
- tasks.push(FBTest.executeCommandAndVerify, "$(\"test-iframe-1\")",
+ tasks.push(FBTest.executeCommandAndVerify, "$(\"#test-iframe-1\")",
/<div\s*id=\"test-iframe-1\">/,
"a", "objectLink objectLink-element");
View
4 tests/content/dom/attributes/attributes.js
@@ -19,11 +19,11 @@ function runTest()
tasks.push(testDomPanel);
tasks.push(executeCommandAndVerify,
- "$('testId').attributes", expectedValue,
+ "$('#testId').attributes", expectedValue,
"a", "objectLink objectLink-NamedNodeMap");
tasks.push(executeCommandAndVerify,
- "$('testId').attributes[0]",
+ "$('#testId').attributes[0]",
expectedValue2,
"a", "objectLink objectLink-Attr");
Please sign in to comment.
Something went wrong with that request. Please try again.