Releases: chharvey/extrajs
Releases · chharvey/extrajs
v0.3.0
Breaking Changes
- remove class-related parameters for
Element.data()
. use attribute-related parameters instead, with aclass
key. -
Element#styleObj()
andElement#addStyleObj()
are now OBSOLETE. Their functionality was added toElement#style()
andElement#addStyle()
respectively. Summary:my_elem.style('background:none; font-weight:bold;') // set the [style] attribute, with a string my_elem.style({background:'none', 'font-weight':'bold'}) // set the [style] attribute, with an object my_elem.style(null) // remove the [style] attribute my_elem.style() // return the value of [style], as a string (or `undefined` if the attribute has not been set) my_elem.style([]) // return the value of [style], as an object my_elem.addStyle('background:none; font-weight:bold;') // add to the [style] attribute my_elem.addStyle({background:'none', 'font-weight':'bold'}) // add to the [style] attribute my_elem.addStyle() // do nothing; return `this`
- The
[style]
attribute is object-first, meaning all CSS is converted into an object before setting/adding styles, and then converted back into a string when rendered.
The default behavior ofElement#addStyle()
has changed. Instead of simply appending to the element’s[style]
attribute, it now overwrites old CSS properties if given new values. For example, the following codeused to returnmy_elem.style('background:none; font-weight:bold;').addStyle('font-weight:normal;').style()
'background:none;font-weight:bold; font-weight:normal;'
, but the new behavior overrides duplicate properties, and so returns'background:none;font-weight:normal;'
.
Non-Breaking Changes
- add new
'M j, Y'
date format (“Mmm dd, yyyy”) - add default parameters to the following methods of
Element
:- Element#attrObj()
- Element#attrStr()
- Element#addClass()
- Element#removeClass()
- Element#addStyle()
- Element#removeStyleProp()
-
Element.data()
now parses instances ofElement
as their actual element, instead of a<dl>
element (in the case of generic objects).