- Detect children inside arrays (out of context, that sounds nice and weird)
- Oopsie, miscalculated the children...
- In Lindt mode, appending new children to a DOM element will not cause existing elements to be removed and reinserted unnecessarily.
- Importer bugfix:
//extcall
now works on arrow functions (JS only)
- Bugfix use of DOM elements inside replace_content (can happen when mixing lindt and choc). Previously it was possible for some such usage to result in elements not being replaced when they should be.
- Bugfix importers not recognizing "import * as name from ..." syntax
- fix_dialogs has been renamed to apply_fixes, with the old name retained for compatibility.
- New fix available: apply_fixes({methods: 1}) will add additional methods to all DOM elements. Currently this provides one method, closest_data().
- Bug fix: Calling replace_content with a non-matching selector will correctly throw an error.
- Importer feature: Class definitions and their methods are correctly parsed, and will behave like other functions (including extcall).
- Importer feature (JS only): Explicit calls to choc.X() or lindt.X() will mark their arguments as Choc Factory context.
- Importer feature: A function definition can be marked with
//extcall
. This has the same effect as giving its name in an--extcall
parameter, but works for functions that are defined somewhere other than global scope. - There is now also a transformation tool available at convert.html to aid in turning HTML into dynamically-generated DOM elements.
- No changes to the Chocolate Factory itself, only the importers
- Bugfix: DOM addition methods (appendChild, etc) had been broken by the importer changes related to SVG handling (keyword args for state). Now unbroken.
- Bugfix: element.prepend() was omitted from the DOM addition method list.
- No changes to the Chocolate Factory itself, only the importers
- chocimport now recognizes XML namespaces correctly and will retain them
- An SVG() constructor will, by default, use the "svg:svg" namespace.
- Lexically-nested calls will replicate the namespace used.
- Implement rudimentary support for XML namespaces such as inline SVG elements.
They are created with
choc("some_namespace:tag")
(or lindt) and may either have the complete namespace included directly, or use an alias via xmlns_xlat for convenience. See the API documentation and SVG usage for further information. - Bugfix: Correct autoimport recognition of renaming imports such as
const {FOO:BAR} = choc; //autoimport
- they will now correctly use BAR.
- Bugfix the flicker reduction - catch some instances where it was overeager in this optimization, resulting in incorrect display.
- Reduce flicker and improve performance in replace_content(). Should™ be entirely backward compatible. Lindt mode will now make better use of existing DOM elements, and will avoid rebuilding contents where possible.
- Attempting to insert a non-Node object into something (with set_content, the choc constructor, or any other form) will now raise an error. This is usually indicative of a bug anyway, and would most likely have caused a more obscure failure.
replace_content(null, lindt.P())
is now broadly equivalent tochoc.P()
, allowing a lindt-based script to turn a template into concrete DOM objects for when it won't be replaced into something else. This has no benefit over using choc directly.
- Calling
e.stopPropagation()
during an on() handler will now correctly end the bubbling of the event. While arguably a bugfix, this is potentially a feature of a sort, I guess?
- Attributes can be specified as
{"@attr": "val"}
or{".attr": "val"}
to force them to use setAttribute or subscript assignment respectively. The default behaviour will continue to autodetect.
- Support
choc.TAG(42)
as equivalent tochoc.TAG("42")
- it was already supported if attributes were given.
- Give the same warning on set_content() that choc() and lindt() do when extra args are provided.
- Handle disabled and checked status through assignment. These could probably be done better with proper boolean handling, but they might still need to be special cases anyway.
- replace_content now accepts a single element rather than requiring an array.
- Master chocolatiers are now available to help design your factory! See Lindt mode for details.
- To strengthen the similarities between choc mode and lindt mode, it's now possible to import choc by name as well as by default. This allows a more consistent import command, instead of having choc special-cased. It will continue to (also) be the default for the foreseeable future.
- chocimport.py recognizes both lindt and choc as valid imports. It's up to you to make sure you use one or the other, or mix them compatibly.
- Constructing a SELECT element with a value should now work - it will fill the element with its contents before applying the value.
- As a side effect of some other changes, it's possible to construct a TEXTAREA with both child text and a value attribute. For compatibility with lindt mode, this is considered a feature, and the value attr wins.
- Special case a few more things. I clearly don't know what I'm doing here.
- Another patch to fix unintended backward compatibility breakage: names beginning with "on" will now create event handlers. This is not recommended and it is better to create handlers using on(), but this does work and will be maintained.
- 1.0 did introduce an unintended backward compatibility break: names like
className
used to work, but nowclass
is needed. Reinstating compat by makingclassname
an alias forclass
, andhtmlfor
an alias forfor
. Others will be added if they get noticed. Sorry about that!
- Very few functional changes, just some cleanups to error handling. This is deemed 1.0 as a recognition of the library's stability.
- Removed deprecated chocify() function
- Disconnected from the shed copy, which will remain for a while as an older copy of this file
- NOTE: Versions will, moving forward, be tagged in git, and thus accessible by URLs such as https://raw.githubusercontent.com/Rosuav/choc/v0.6.1/factory.js
- Removed documentation from core code file into an external Markdown file
- Added an explicit error when attempting to set_content a missing element (replacing the obscure "cannot read lastChild of undefined" error)
- Element attributes are now case insensitive. You no longer have to write
TD({colSpan: 2})
, it's now fine to writeTD({colspan: 2})
. - Data attributes that include hyphens are now handled according to the HTML spec, instead of causing an error.
- Added a warning if extra args are passed eg
DIV({id}, SPAN(), SPAN())
choc.__version__
will now always contain three parts,maj.min.rev
.
- Last version available at https://rosuav.github.io/shed/chocfactory.js
- set_content now accepts arrays of arrays of elements, nested arbitrarily.
- Added options parameter to event hooks:
on("click", ".spam", e => ..., opt)
This allows additional options such as using the capturing phase.
- Added formless mode to fix_dialogs click_outside
- [0.4.4] Hack the setting of an input's form attribute so it works
- [0.4.3] Fix handling of click_outside with select elements
- [0.4.2] Improve handling of
- [0.4.1] Hack in some button handling
- [0.4] Hack in basic handling of on Firefox
- Implement a dialog fixer to add basic support for all browsers, even those that don't natively handle dialogs properly
- Added the DOM() function to grab a single DOM element by selector
- Tightened up error handling
- Initial release, in several stages all with the same version number.