t2ym/i18n-number

[4.0] Remove dependency on Polymer library

Closed this issue · 0 comments

t2ym commented

[4.0] Remove dependency on Polymer library

Status

Tasks

  • Move @polymer/polymer from dependencies to devDependencies
  • Drop Safari 9 support
    • Remove intl package dependency
  • bower.json with BSD-2-Clause as license
  • Add lit-html dependency
  • Remove intl loading mechanism
  • Convert to lit-html rendering
    • Remove @polymer/polymer imports
    • Convert properties and observers
  • Support IE11 and Edge with custom elements v1 polyfill
    • Temporarily insert polyfill.js contents from i18n-element/polyfill.js
    • Import a separate polyfill.js from an independent npm module for polyfill.js
      • Create npm package wc-putty and import
  • Convert tests
    • No Polymer methods
    • Add some waits
  • Convert demo
    • Remove intl from extraDependencies in polymer.json
  • Documentation
    • Decent comments
    • API Docs page

Design Issues

  • How to port notifyPath() feature from Polymer?
    • Just call _onOptionsPropertyChanged()
  • Is reflectToAttribute feature required? No
  • root property for shadowRoot to imitate a Polymer element
  • Should attachShadow() be put off until the first rendering like i18n-format? Yes
    • i18n-element tests fail with <plural-gender-element>
  • Should assignment of this.lang with the default value be put off until connectedCallback? Yes
  • Is importMeta property necessary? No.

Issues

  • document.createElement('i18n-number') fails with "The result must not have attributes"
    • Fix: Put off setting this.lang in the constructor to the next microtask timing
    • Fix: Add 'null' guards for lang property
  • lang attribute/property is unexpectedly set to "en"
window.t = document.createElement('template');
t.innerHTML = '<i18n-number id="overridden-lang" lang="fr">12.34</i18n-number>'
document.body.appendChild(t.content);
document.querySelector('i18n-number#overridden-lang').lang === 'fr' // must be true, actually false
  • Root Cause: lang has to be set at connectedCallback instead of the microtask timing after constructor