Skip to content

Commit

Permalink
Use names in object-arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
sroussey committed Aug 14, 2012
1 parent 2e0bcb0 commit f924896
Showing 1 changed file with 26 additions and 57 deletions.
83 changes: 26 additions & 57 deletions extension/content/firebug/chrome/reps.js
Expand Up @@ -547,33 +547,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)
{
Expand Down Expand Up @@ -732,97 +707,92 @@ 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
isArray: function(obj, win)
{
if (mightBeArray(obj, win))
{
if (isFinite(obj.length) && typeof obj.callee === "function") // arguments
return true;
else if (Arr.isArray(obj))
return true;
}
return false;
},

getTitle: function(object, context)
getTitleTag: 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"})
),

shortTag:
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"})
),

shortTag:
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"})
),

isArray: function(obj, win)
{
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;
Expand All @@ -833,7 +803,7 @@ FirebugReps.NodeCollection = domplate(FirebugReps.Arr,
},
});


// ********************************************************************************************* //

FirebugReps.Property = domplate(Firebug.Rep,
Expand Down Expand Up @@ -3222,7 +3192,6 @@ Firebug.registerRep(
FirebugReps.Except,
FirebugReps.XML,
FirebugReps.Arr,
FirebugReps.NodeCollection,
FirebugReps.ArrayishObject,
FirebugReps.XPathResult,
FirebugReps.Storage,
Expand Down

0 comments on commit f924896

Please sign in to comment.