switer / switer.github.io

Personal homepage
https://switer.github.io
5 stars 0 forks source link

web component #6

Open switer opened 10 years ago

switer commented 10 years ago

按照W3C对web component定义的草案(2013年6月),一个 componet 包含的重要部件有:

  1. Templates 形态为被动的markup chunks,但是之后可以被激活使用.

    define chunks of markup that are inert but can be activated for use later.

  2. Decorators 这里装饰者被定义为CSS的修饰,生命周期短暂,无状态,但可以通过JS添加交互行为(例如CSS的hover?)——介绍观点,未形成规范

    apply templates based on CSS selectors to affect rich visual and behavioral changes to documents.

  3. Custom Elements 使用者自定义的组件元素,基于component的可定制性

    which let authors define their own elements, with new tag names and new script interfaces.

  4. Shadow DOM 我认为它是当前组件的子组件,DOM结构对于当前component为不可见的,但使用当前组件的资源和状态。
    • shadow dom拥有elements混入功能,使component的elements插入 shadow dom 树中,vue.js的partial就是该定义的实现

      which encapsulates a DOM subtree for more reliable composition of user interface elements.

  5. Imports 组件/资源的导入机制

    which defines how templates, decorators and custom elements are packaged and loaded as a resource.

link

switer commented 10 years ago

:signal_strength: