Skip to content

Releases: chemerisuk/better-dom

Version 2.1.2

22 Jan 17:56
Compare
Choose a tag to compare
  • deep code refactoring
  • DOM.extend and DOM.mock were moved to $Document.prototype
  • critical bug fix for IE8's innerHTML hook
  • drop experimental $Element#context

Version 2.1.1

16 Dec 14:35
Compare
Choose a tag to compare
  • critical bug fixes in $Element$define for IE8
  • introduce new methods $Element#empty and $Element#value (thanks to @nateroling)
  • major improvements in $Element#context implementation
  • various enhancements in internal infrastructure

Version 2.1.0

13 Dec 11:08
Compare
Choose a tag to compare

New features

  • DOM.requestFrame and DOM.cancelFrame to work with animation frames
  • DOM.format supports functions in template strings for advanced formatting
  • DOM.emmet encodes values inside of back ticks, so they are always safe
  • new $Element#map to invoke function on element if the element exists
  • introduce $Element#context (experimental)
  • DOM.importStyles now supports at-rules too

API improvements

  • CSS accessor module was rewritten - now you can use $Element#css for SVG properties too!
  • major performance boost for declarative animations: no forced layout before animation
  • visibility methods now don't touch display property to avoid unnecessary layouts
  • DOM.importStyles supports only string as the second argument
  • the first argument for $Element#clone is required (standards-based behavior)
  • drop $Element#defineProperty because it's useless
  • rename $Element#defineAttribute to $Element.define and now it accepts just two functions instead of the configuration object
  • private functions (on*, do*) are deprecated in favour of methods that start with _

Version 2.0.2

24 Oct 17:31
Compare
Choose a tag to compare
  • major refactoring of visibility methods
  • various performance improvements in visibility methods
  • visibility methods process correctly all word and multiple transitions
  • argument callback is always async in visibility methods
  • $Element#defineAttribute uses lowercased attribute name
  • DOM.format can accept non-string values
  • more readable compiled code
  • fixed legacy IE improvements

Version 2.0.1

17 Oct 13:28
Compare
Choose a tag to compare

API improvements

  • DOM extends $Element and wraps document.documentElement
  • method renaming: DOM.template -> DOM.emmet, $Element#style -> $Element#css
  • visibility methods can apply CSS3 animation on an element
  • update class manipulation methods to match the spec
  • new $Element#defineProperty and $Element#defineAttribute
  • new DOM.format for string formatting
  • new DOM.constructor for getting wrapper for a native element
  • style hook for getter/setter
  • handler arguments support access to event arguments via numeric values
  • handler arguments pass non-numeric and non-string values through
  • smart quotes (back ticks) in DOM.emmet
  • title hook for DOM (should get/set document.title)
  • new DOM.noConflict to safe working with several versions of the library
  • move i18n methods into a separate project better-i18n
  • version constant on $Element-level
  • DOM.importStyles doesn't fail on invalid selectors
  • $Element#toString returns "<a>" not "a"

API cleanup

  • *All methods return real arrays instead of array-like objects
  • argument selector is a separate string in $Element#on[ce]
  • drop deprecated DOM.ready: use DOM.extend instead
  • drop $Element#legacy: use [0] instead
  • drop deprecated $Element#data: use $Element#get instead
  • drop $Element#parent: use $Element#closest instead
  • manipulation methods support only single argument, Array.<$Element> is acceptable
  • drop andSelf argument from traversing methods
  • late binding support was removed from event handlers

Infrastructure

  • ES6 transpilers for modules and source code
  • migrate to gulp
  • better jsdocs template
  • sauce labs for automated testing on different environments

v1.7.0

06 Feb 12:00
Compare
Choose a tag to compare

Improvements:

  • custom builds support
  • introduced better-dom-legacy.js which isolates some IE8-9 specific fixes from other code
  • animations do not require setting display property in CSS
  • various syntax improvements in the Emmet parser
  • variables in $Element.i18n and Emmet strings have {varName} form (no dollar prefix)
  • arrays can be used to specify variables in $Element.i18n or Emmet strings
  • $Element.show, $Element.hide, $Element.toggle accept optional callback argument to catch the moment when animation ends
  • DOM.extend supports optional argument condition which allows to skip feature detection in tests
  • DOM.extend does not mix methods that start with on or do into an element interface
  • $Node.dispatch for making safe calls
  • DOM.mock accepts optional variables for an Emmet abbreviation
  • $Element.get, $Element.data, $Element.style support array argument to retrieve several values
  • $Element.next[All], $Element.prev[All], $Element.parent support optional andSelf argument
  • pointer-events:none is applied inline to prevent accidental actions during an animation
  • $Element.matches supports special :visible hook (which is reverse of :hidden)
  • toString returns a lowercased tag name of the element or empty string
  • improved API documentation: added modules section, used better template
  • update es5-shim version to the latest

Performance:

  • $Element constructor should be faster
  • use querySelectorAll instead of matchesSelector for testing an element during event delegation except Webkit-based browsers because it's faster

API cleanup:

  • extract $Elements constructor for collections
  • event handlers accept ["target", "currentTarget", "defaultPrevented"] by default
  • currentTarget is used instead of target to find the element that matches event selector
  • $Element.toggle accepts the same arguments as $Element.show and $Element.hide
  • drop context argument from $Node.on, $Node.once, $Node.off - use Function.prototype.bind instead!
  • DOM.extend does not support constructor function as the second argument
  • $Element.child does not support optional argument selector

Bug fixing:

  • various bug fixes in DOM.extend
  • $Node.once works properly with late binding
  • DOM.template handles boolean attributes properly
  • DOM.template does not cache abbreviations that have the varMap argument
  • fix reflow problem in IE8 on attribute change
  • Android 2.3 specific bug fixes
  • $Element.clone works on empty elements
  • $Element.i18n works for collections

v1.6.0

28 Nov 12:41
Compare
Choose a tag to compare

Improvements:

  • used browserify with node.js-like syntax instead of hacky AMD for module system
  • $Node.fire returns !defaultPrevented
  • $Node.fire supports multiple extra arguments
  • $Node.on: event properties array moved to the end of the method signature
  • $Node.on: "detail" event property returns native value instead of event data
  • $Node.on: event type could be an array
  • $Node.data: object notation syntax is supported for data attributes
  • $Element.clone supports optional deep argument
  • $Element.set, $Element.style, $Element.toggle accept functor that has (el, index, this) arguments and global context
  • $Element.show, $Element.hide support optional delay argument
  • revised i18n: no *en.js files anymore - english strings are used as resource keys
  • $Element.i18n: variable syntax is consistent with DOM.template
  • add textContent hook for IE8 via innerText
  • DOM.template supports variables in abbreviations
  • DOM.extend doesn't expose event handler methods (/^on[A-Z]/) into element interface
  • DOM.mock exposes event handler methods into element interface

Performace:

  • $Element constructor is faster
  • DOM.template supports memoization of results
  • SelectorMatcher has optimized support for [attr=value] selectors
  • improve $Node.on by reducing function calls and earlier cancelling in case of event delegation
  • lot of different performance optimizations in DOM.extend and DOM.create

API cleanup:

  • drop DOM.watch because of incossistent behavior in different browsers
  • drop $Node.supports: use $Node.legacy for feature checking instead
  • no more : operator support in emmet abbreviations - use [type=xxx] instead
  • DOM.create accepts optional emmet variables object instead of attrs and styles
  • drop $Element.width and $Element.height - use appropriate properties of the object returned by $Element.offset

Bug fixing:

  • DOM.extend works properly with DOM.ready
  • DOM.create doesn't wrap collections with extra div
  • DOM.data doesn't throw exception
  • manipulation methods work properly with detached elements
  • traversing and searching methods return empty node at least
  • various fixes of default styles for [aria-hidden=true]
  • fix DOM.importScripts in case of single url with no callback
  • $Element.style sets composite css properties correctly

v1.5.0

29 Sep 16:46
Compare
Choose a tag to compare

Improvements:

  • $Element.set(value) accepts primitive types and function
  • DOM.importScripts can be used to load scripts one-by-one
  • $Element.on now fixes target property: the element always matches event selector if it exists
  • introduce $Element.width() and $Element.height()
  • it's possible to cleanup style value using $Element.style with null, undefined or empty string
  • add CommonJS modules support
  • main files moved into the dist folder
  • change jsdoc template

API cleanup:

  • getData/setData were renamed to data
  • getStyle/setStyle were renamed to style
  • DOM.parseTemplate was renamed to DOM.template
  • $Element.unsafe was renamed to $Element.legacy and respects current context

Bug fixing:

  • DOM.create and manipulation methods now trim HTML strings
  • DOM.watch and DOM.extend allow to catch the same element via different selectors
  • manipulation methods don't fail on an empty string