html - Should I manually register custom knockout elements to the DOM? -


in knockout can create custom elements can this:

<flight-deals params='from: "lhr", to: "sfo"'></flight-deals> 

the definition of custom elements in html still work in progress , part of process of using today register custom element dom using document.registerelement.

however, can not find in knockout documentation regarding these aspects, , when investigate if custom elements registered dom knockout after calling ko.components.register, turn out not be.

so if i'm using custom elements in knockout, should make sure register these manually using document.registerelement? fact knockout not makes me little confused.

you don't need special modern browsers , ie9+.

for ie6 - ie8 support need aware of , use wee bit of magic. the relevant documentation mentions:

  • html5-era browsers, includes internet explorer 9 , later, automatically allow custom elements no difficulties.
  • internet explorer 6 8 supports custom elements, but if registered before html parser encounters of elements.

ie 6-8’s html parser discard unrecognized elements. ensure doesn’t throw out custom elements, must 1 of following:

  • ensure call ko.components.register('your-component') before html parser sees <your-component> elements
  • or, @ least call document.createelement('your-component') before html parser sees <your-component> elements. can ignore result of createelement call — matters have called it.

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -