New: appkit_tag_dom_elements now tags with UIDs too.

Tagging with UIDs can make it much easier to debug encoding/decoding related bugs where it's not clear that the right view ended up in the right spot.

The new data attribute is called "data-cappuccino-uid".

Also collect and simplify appkit_tag_dom_elements code a little.
This commit is contained in:
Alexander Ljungberg committed 2013-07-08 17:05:22 +01:00
1 parent 0badf30763
commit b258b1a164
2 files changed
+19 -5

No files matched your search

+1 -2
View File
@@ -108,9 +108,8 @@ var CPImageViewEmptyPlaceholderImage = nil;
}
_DOMImageElement.style.visibility = "hidden";
AppKitTagDOMElement(self, _DOMImageElement);
if (typeof(appkit_tag_dom_elements) !== "undefined" && appkit_tag_dom_elements)
_DOMImageElement.setAttribute("data-cappuccino-view", [self className]);
CPDOMDisplayServerAppendChild(_DOMElement, _DOMImageElement);
}
+18 -3
View File
@@ -43,6 +43,22 @@
@global appkit_tag_dom_elements
if (typeof(appkit_tag_dom_elements) !== "undefined" && appkit_tag_dom_elements)
{
AppKitTagDOMElement = function(owner, element)
{
element.setAttribute("data-cappuccino-view", [owner className]);
element.setAttribute("data-cappuccino-uid", [owner UID]);
}
}
else
{
AppKitTagDOMElement = function(owner, element)
{
// By default, do nothing.
}
}
/*
@global
@group CPViewAutoresizingMasks
@@ -316,13 +332,11 @@ var CPViewFlags = { },
#if PLATFORM(DOM)
_DOMElement = DOMElementPrototype.cloneNode(false);
AppKitTagDOMElement(self, _DOMElement);
CPDOMDisplayServerSetStyleLeftTop(_DOMElement, NULL, CGRectGetMinX(aFrame), CGRectGetMinY(aFrame));
CPDOMDisplayServerSetStyleSize(_DOMElement, width, height);
if (typeof(appkit_tag_dom_elements) !== "undefined" && !!appkit_tag_dom_elements)
_DOMElement.setAttribute("data-cappuccino-view", [self className]);
_DOMImageParts = [];
_DOMImageSizes = [];
#endif
@@ -3053,6 +3067,7 @@ var CPViewAutoresizingMaskKey = @"CPViewAutoresizingMask",
// a more "elegant" way to do this...?
#if PLATFORM(DOM)
_DOMElement = DOMElementPrototype.cloneNode(false);
AppKitTagDOMElement(self, _DOMElement);
#endif
// Also decode these "early".