Releases: chemerisuk/better-dom
Releases · chemerisuk/better-dom
Version 2.1.2
- deep code refactoring
DOM.extend
andDOM.mock
were moved to$Document.prototype
- critical bug fix for IE8's
innerHTML
hook - drop experimental
$Element#context
Version 2.1.1
- 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
New features
DOM.requestFrame
andDOM.cancelFrame
to work with animation framesDOM.format
supports functions in template strings for advanced formattingDOM.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
- 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 nameDOM.format
can accept non-string values- more readable compiled code
- fixed legacy IE improvements
Version 2.0.1
API improvements
DOM
extends$Element
and wrapsdocument.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 forDOM
(should get/setdocument.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
-levelDOM.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
: useDOM.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
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
ordo
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 ofmatchesSelector
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 oftarget
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
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 viainnerText
- 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
andstyles
- 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
Improvements:
$Element.set(value)
accepts primitive types and functionDOM.importScripts
can be used to load scripts one-by-one$Element.on
now fixestarget
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
withnull
,undefined
or empty string - add CommonJS modules support
- main files moved into the
dist
folder - change jsdoc template
API cleanup:
getData
/setData
were renamed todata
getStyle
/setStyle
were renamed tostyle
DOM.parseTemplate
was renamed toDOM.template
$Element.unsafe
was renamed to$Element.legacy
and respects current context
Bug fixing:
DOM.create
and manipulation methods now trim HTML stringsDOM.watch
andDOM.extend
allow to catch the same element via different selectors- manipulation methods don't fail on an empty string