diff --git a/AppKit/CPImageView.j b/AppKit/CPImageView.j index 7d58496d8..24f183f82 100644 --- a/AppKit/CPImageView.j +++ b/AppKit/CPImageView.j @@ -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); } diff --git a/AppKit/CPView.j b/AppKit/CPView.j index 67c5b88f7..cdf61659b 100644 --- a/AppKit/CPView.j +++ b/AppKit/CPView.j @@ -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".