Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use names in object-arrays

  • Loading branch information...
commit 11913bb82c7953ffad76be7ca9135a20a34edaab 1 parent 29a12d4
@sroussey authored
Showing with 25 additions and 43 deletions.
  1. +25 −43 extension/content/firebug/chrome/reps.js
View
68 extension/content/firebug/chrome/reps.js
@@ -552,33 +552,8 @@ function mightBeArray(obj, win)
return true;
}
-FirebugReps.Arr = domplate(Firebug.Rep,
+FirebugReps.ArrBase = domplate(Firebug.Rep,
{
- tag:
- OBJECTBOX({_repObject: "$object",
- $hasTwisty: "$object|hasSpecialProperties",
- onclick: "$onToggleProperties"},
- SPAN({"class": "arrayLeftBracket", role: "presentation"}, "["),
- FOR("item", "$object|longArrayIterator",
- TAG("$item.tag", {object: "$item.object"}),
- SPAN({"class": "arrayComma", role: "presentation"}, "$item.delim")
- ),
- SPAN({"class": "arrayRightBracket", role: "presentation"}, "]"),
- SPAN({"class": "arrayProperties", role: "group"})
- ),
-
- shortTag:
- OBJECTBOX({_repObject: "$object",
- $hasTwisty: "$object|hasSpecialProperties",
- onclick: "$onToggleProperties"},
- SPAN({"class": "arrayLeftBracket", role: "presentation"}, "["),
- FOR("item", "$object|shortArrayIterator",
- TAG("$item.tag", {object: "$item.object"}),
- SPAN({"class": "arrayComma", role: "presentation"}, "$item.delim")
- ),
- SPAN({"class": "arrayRightBracket"}, "]"),
- SPAN({"class": "arrayProperties", role: "group"})
- ),
longArrayIterator: function(array)
{
@@ -737,6 +712,8 @@ FirebugReps.Arr = domplate(Firebug.Rep,
// Highlight multiple elements on the page.
Firebug.Inspector.highlightObject(arr, context);
},
+ titleTag:
+ SPAN({"class": "objectTitle"}, "$object|getTitleTag"),
// 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
@@ -764,21 +741,21 @@ FirebugReps.Arr = domplate(Firebug.Rep,
getTitle: function(object, context)
{
return "[" + object.length + "]";
- }
+ }
});
-
-FirebugReps.ArrayishObject = domplate(FirebugReps.Arr,
+
+FirebugReps.Arr = domplate(FirebugReps.ArrBase,
{
tag:
OBJECTBOX({_repObject: "$object",
$hasTwisty: "$object|hasSpecialProperties",
onclick: "$onToggleProperties"},
- SPAN({"class": "arrayLeftBracket", role: "presentation"}, "{["),
+ SPAN({"class": "arrayLeftBracket", role: "presentation"}, "["),
FOR("item", "$object|longArrayIterator",
TAG("$item.tag", {object: "$item.object"}),
SPAN({"class": "arrayComma", role: "presentation"}, "$item.delim")
),
- SPAN({"class": "arrayRightBracket", role: "presentation"}, "]}"),
+ SPAN({"class": "arrayRightBracket", role: "presentation"}, "]"),
SPAN({"class": "arrayProperties", role: "group"})
),
@@ -786,38 +763,42 @@ FirebugReps.ArrayishObject = domplate(FirebugReps.Arr,
OBJECTBOX({_repObject: "$object",
$hasTwisty: "$object|hasSpecialProperties",
onclick: "$onToggleProperties"},
- SPAN({"class": "arrayLeftBracket", role: "presentation"}, "{["),
+ SPAN({"class": "arrayLeftBracket", role: "presentation"}, "["),
FOR("item", "$object|shortArrayIterator",
TAG("$item.tag", {object: "$item.object"}),
SPAN({"class": "arrayComma", role: "presentation"}, "$item.delim")
),
- SPAN({"class": "arrayRightBracket"}, "]}"),
+ SPAN({"class": "arrayRightBracket"}, "]"),
SPAN({"class": "arrayProperties", role: "group"})
),
-
+
+ // http://code.google.com/p/fbug/issues/detail?id=874
isArray: function(obj, win)
{
if (mightBeArray(obj, win))
{
- if (isFinite(obj.length) && typeof obj.splice === "function")
+ if (isFinite(obj.length) && typeof obj.callee === "function") // arguments
+ return true;
+ else if (Arr.isArray(obj))
return true;
}
return false;
- },
+ }
});
-FirebugReps.NodeCollection = domplate(FirebugReps.Arr,
+FirebugReps.ArrayishObject = domplate(FirebugReps.ArrBase,
{
tag:
OBJECTBOX({_repObject: "$object",
$hasTwisty: "$object|hasSpecialProperties",
onclick: "$onToggleProperties"},
- SPAN({"class": "arrayLeftBracket", role: "presentation"}, "<["),
+ SPAN({"class": "objectTitle"}, "$object|getTitle "),
+ SPAN({"class": "arrayLeftBracket", role: "presentation"}, "{["),
FOR("item", "$object|longArrayIterator",
TAG("$item.tag", {object: "$item.object"}),
SPAN({"class": "arrayComma", role: "presentation"}, "$item.delim")
),
- SPAN({"class": "arrayRightBracket", role: "presentation"}, "]>"),
+ SPAN({"class": "arrayRightBracket", role: "presentation"}, "]}"),
SPAN({"class": "arrayProperties", role: "group"})
),
@@ -825,12 +806,12 @@ FirebugReps.NodeCollection = domplate(FirebugReps.Arr,
OBJECTBOX({_repObject: "$object",
$hasTwisty: "$object|hasSpecialProperties",
onclick: "$onToggleProperties"},
- SPAN({"class": "arrayLeftBracket", role: "presentation"}, "<["),
+ SPAN({"class": "arrayLeftBracket", role: "presentation"}, "{["),
FOR("item", "$object|shortArrayIterator",
TAG("$item.tag", {object: "$item.object"}),
SPAN({"class": "arrayComma", role: "presentation"}, "$item.delim")
),
- SPAN({"class": "arrayRightBracket"}, "]>"),
+ SPAN({"class": "arrayRightBracket"}, "]}"),
SPAN({"class": "arrayProperties", role: "group"})
),
@@ -838,6 +819,8 @@ FirebugReps.NodeCollection = domplate(FirebugReps.Arr,
{
if (mightBeArray(obj, win))
{
+ if (isFinite(obj.length) && typeof obj.splice === "function" && obj.length)
+ return true;
var view = Wrapper.getContentView(win || window);
if (obj instanceof view.HTMLCollection)
return true;
@@ -848,7 +831,7 @@ FirebugReps.NodeCollection = domplate(FirebugReps.Arr,
},
});
-
+
// ********************************************************************************************* //
FirebugReps.Property = domplate(Firebug.Rep,
@@ -3242,7 +3225,6 @@ Firebug.registerRep(
FirebugReps.Except,
FirebugReps.XML,
FirebugReps.Arr,
- FirebugReps.NodeCollection,
FirebugReps.ArrayishObject,
FirebugReps.XPathResult,
FirebugReps.Storage,
Please sign in to comment.
Something went wrong with that request. Please try again.