Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix up the rest of console $ change

  • Loading branch information...
commit d8eca5057bf6bcf430570e8b6bc17f4e47ec1cf9 1 parent 354a0bf
steve authored committed
View
30 extension/content/firebug/console/commandLine.js
@@ -1052,20 +1052,23 @@ function FirebugCommandLineAPI(context)
this.$ = function(selector, start) // returns unwrapped elements from the page
{
var result;
- if (start && start.querySelector && (start.nodeType == Node.ELEMENT_NODE || start.nodeType == Node.DOCUMENT_NODE || start.nodeType == Node.DOCUMENT_FRAGMENT_NODE))
- result = start.querySelector(selector);
- else
+ 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 = Wrapper.unwrapObject(context.baseWindow.document).querySelector(selector);
+ if (result == null && (selector||"")[0] !== "#")
{
- result = Wrapper.unwrapObject(context.baseWindow.document).querySelector(selector);
- if (result == null && (selector||"")[0] !== "#")
+ result = Wrapper.unwrapObject(context.baseWindow.document).querySelector("#" + selector);
+ if (result != null)
{
- result = Wrapper.unwrapObject(context.baseWindow.document).querySelector("#" + selector);
- if (result != null)
- {
- // This should be removed in the next minor (non-bugfix) version
- Firebug.Console.log("The console function $() has changed from $=getElementById(id) to $=querySelector(selector). You might try $(\"#" + selector + "\")", context, "warn");
- result = null;
- }
+ // 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;
@@ -1074,8 +1077,9 @@ function FirebugCommandLineAPI(context)
this.$$ = function(selector, start) // returns unwrapped elements from the page
{
var result;
- if (start && start.querySelectorAll && (start.nodeType == Node.ELEMENT_NODE || start.nodeType == Node.DOCUMENT_NODE || start.nodeType == Node.DOCUMENT_FRAGMENT_NODE))
+ 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 = Wrapper.unwrapObject(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):
Please sign in to comment.
Something went wrong with that request. Please try again.