Releases: chemerisuk/better-dom
Releases · chemerisuk/better-dom
Version 2.1.2
- deep code refactoring
DOM.extendandDOM.mockwere moved to$Document.prototype- critical bug fix for IE8's
innerHTMLhook - drop experimental
$Element#context
Version 2.1.1
- critical bug fixes in
$Element$definefor IE8 - introduce new methods
$Element#emptyand$Element#value(thanks to @nateroling) - major improvements in
$Element#contextimplementation - various enhancements in internal infrastructure
Version 2.1.0
New features
DOM.requestFrameandDOM.cancelFrameto work with animation framesDOM.formatsupports functions in template strings for advanced formattingDOM.emmetencodes values inside of back ticks, so they are always safe- new
$Element#mapto invoke function on element if the element exists - introduce
$Element#context(experimental) DOM.importStylesnow supports at-rules too
API improvements
- CSS accessor module was rewritten - now you can use
$Element#cssfor SVG properties too! - major performance boost for declarative animations: no forced layout before animation
- visibility methods now don't touch
displayproperty to avoid unnecessary layouts DOM.importStylessupports only string as the second argument- the first argument for
$Element#cloneis required (standards-based behavior) - drop
$Element#definePropertybecause it's useless - rename
$Element#defineAttributeto$Element.defineand 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
allword and multiple transitions - argument
callbackis always async in visibility methods $Element#defineAttributeuses lowercased attribute nameDOM.formatcan accept non-string values- more readable compiled code
- fixed legacy IE improvements
Version 2.0.1
API improvements
DOMextends$Elementand 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#definePropertyand$Element#defineAttribute - new
DOM.formatfor string formatting - new
DOM.constructorfor getting wrapper for a native element stylehook 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 titlehook forDOM(should get/setdocument.title)- new
DOM.noConflictto safe working with several versions of the library - move i18n methods into a separate project better-i18n
versionconstant on$Element-levelDOM.importStylesdoesn't fail on invalid selectors$Element#toStringreturns"<a>"not"a"
API cleanup
*Allmethods return real arrays instead of array-like objects- argument
selectoris a separate string in$Element#on[ce] - drop deprecated
DOM.ready: useDOM.extendinstead - drop
$Element#legacy: use[0]instead - drop deprecated
$Element#data: use$Element#getinstead - drop
$Element#parent: use$Element#closestinstead - manipulation methods support only single argument,
Array.<$Element>is acceptable - drop
andSelfargument 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.jswhich isolates some IE8-9 specific fixes from other code - animations do not require setting
displayproperty 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
conditionwhich allows to skip feature detection in tests - DOM.extend does not mix methods that start with
onordointo 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
andSelfargument pointer-events:noneis applied inline to prevent accidental actions during an animation- $Element.matches supports special
:visiblehook (which is reverse of:hidden) toStringreturns a lowercased tag name of the element or empty string- improved API documentation: added modules section, used better template
- update
es5-shimversion to the latest
Performance:
- $Element constructor should be faster
- use
querySelectorAllinstead ofmatchesSelectorfor 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 currentTargetis used instead oftargetto 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
varMapargument - 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
deepargument - $Element.set, $Element.style, $Element.toggle accept functor that has
(el, index, this)arguments and global context - $Element.show, $Element.hide support optional
delayargument - revised i18n: no *en.js files anymore - english strings are used as resource keys
- $Element.i18n: variable syntax is consistent with DOM.template
- add
textContenthook 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
attrsandstyles - 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.importScriptscan be used to load scripts one-by-one$Element.onnow fixestargetproperty: the element always matches event selector if it exists- introduce
$Element.width()and$Element.height() - it's possible to cleanup style value using
$Element.stylewithnull,undefinedor empty string - add CommonJS modules support
- main files moved into the
distfolder - change jsdoc template
API cleanup:
getData/setDatawere renamed todatagetStyle/setStylewere renamed tostyleDOM.parseTemplatewas renamed toDOM.template$Element.unsafewas renamed to$Element.legacyand respects current context
Bug fixing:
DOM.createand manipulation methods now trim HTML stringsDOM.watchandDOM.extendallow to catch the same element via different selectors- manipulation methods don't fail on an empty string