YUILibrary - Open source JavaScript and CSS for building richly interactive software.
Fork YUI on GitHub

YUI 2.x

Ticket #2528249 (closed defect)

Reporter


Todd Kloots
Opened: 09/17/09
Last modified: 09/29/09
Status: closed
Type: defect
Resolution: fixed

Owner


Satyen Desai
Target Release: 3.0.0 GA
Priority: P3 (normal)
Summary: "type" attribute not available for Node instance augmented with Attribute
Description:

When a Node instance is augmented with Attribute, the "type" attribute returns "undefined" where prior to augmentation it returns the corresponding value of the raw DOM attribute.

Type: defect Observed in Version: development master
Component: Attribute Severity: S3 (normal)
Assigned To: Satyen Desai Target Release: 3.0.0 GA
Location: Library Code Priority: P3 (normal)
Tags: Relates To:
Browsers: N/A
URL:
Test Information:

Attachments

Attachment #1: node-attribute-test.html (download)

Change History

Satyen Desai

YUI Developer

Posted: 09/17/09
  • location changed to Library Code
  • milestone changed to 3.0.0 GA
  • status changed from new to accepted

Node sets up type as a managed ATTR...

Y.Node.ATTRS.type = {
setter: function(val) {
if (val === 'hidden') {
try {
this._node.type = 'hidden';
} catch(e) {
this._node.style.display = 'none';
}
}
return val;
}
};

However, since there's no getter, Attribute goes to "state" instead of "stateProxy" [ the node ] to get the attribute value, the (probably incorrect) assumption being if it's and attribute which as been added, the value is stored in state.

Will need to revisit the following conditional as a result:

_getStateVal : function(name) {
var stateProxy = this._stateProxy;

// If it's added, don't automatically assume the value is stored in state.
if (!stateProxy || this.attrAdded(name)) {
return this._state.get(name, VALUE);
} else {
return (stateProxy && stateProxy[name]);
}
},

Worth fixing for GA for the Node/Augmented with Attribute use case.

Satyen Desai

YUI Developer

Posted: 09/18/09
  • status changed from accepted to checkedin

Commited. Attribute tests all pass. Smoke test on a couple of Anim, DD, Slider, Widget, Overlay examples looks fine.

commit 78122fcb250c1bbadb9d6de392cbb0ef67d3898b
Author: Satyen Desai sdesai@yahoo-inc.com
Date: Thu Sep 17 18:00:19 2009 -0700

Added internal configuration property (_bypassProxy) to allow Node to selectively define attributes it does not want to pass through transparently to the _stateProxy. Also changed logic which determines whether or not value is stored in _stateProxy if _stateProxy exists. Fixes #2528249

Satyen Desai

YUI Developer

Posted: 09/18/09

Forgot to add. Attached test case also passes with the above fix in Safari. "type" retrieval still has the potential to fail in IE for "hidden" until Matt fixes #2528249.

Satyen Desai

YUI Developer

Posted: 09/18/09
  • resolution changed to fixed

Added internal configuration property (_bypassProxy) to allow Node to selectively define attributes it does not want to pass through transparently to the _stateProxy. Also changed logic which determines whether or not value is stored in _stateProxy if _stateProxy exists. Fixes #2528249
View Commit: 78122fcb250c1bbadb9d6de392cbb0ef67d3898b

George

YUI Developer

Posted: 09/29/09
  • status changed from checkedin to closed