Skip to content

v0.3.0

Compare
Choose a tag to compare
@chharvey chharvey released this 29 Aug 19:01
· 470 commits to master since this release

Breaking Changes

  • remove class-related parameters for Element.data(). use attribute-related parameters instead, with a class key.
  • Element#styleObj() and Element#addStyleObj() are now OBSOLETE. Their functionality was added to Element#style() and Element#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 of Element#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 code
    my_elem.style('background:none; font-weight:bold;').addStyle('font-weight:normal;').style()
    used to return '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 of Element as their actual element, instead of a <dl> element (in the case of generic objects).