32
Shadow DOM & Virtual DOM @scott_sword

Shadow dom & Virtual dom

Embed Size (px)

Citation preview

Page 1: Shadow dom  & Virtual dom

Shadow DOM&

Virtual DOM

@scott_sword

Page 2: Shadow dom  & Virtual dom

What is the DOM?

Page 3: Shadow dom  & Virtual dom

The Document Object Model (DOM) is a programming interface for HTML, XML and SVG documents. It provides a structured

representation of the document (a tree) and it defines a way that the structure can be accessed from programs so that they can

change the document structure, style and content. The DOM provides a representation of the document as a structured group of

nodes and objects that have properties and methods. Nodes can also have event handlers attached to them, and once that event

is triggered the event handlers get executed. Essentially, it connects web pages to scripts or programming languages.

Page 4: Shadow dom  & Virtual dom

The DOM is what the browser actuallyrenders with the provided assets.

Page 5: Shadow dom  & Virtual dom

1) A tree of nodes that the browser renders with your assets.

Page 6: Shadow dom  & Virtual dom

1) A tree of nodes that the browser renders with your assets.

1) An API for you to interact w/ via JS.

Page 7: Shadow dom  & Virtual dom
Page 8: Shadow dom  & Virtual dom
Page 9: Shadow dom  & Virtual dom

What is the Shadow DOM?

Page 10: Shadow dom  & Virtual dom
Page 11: Shadow dom  & Virtual dom
Page 12: Shadow dom  & Virtual dom
Page 13: Shadow dom  & Virtual dom
Page 14: Shadow dom  & Virtual dom

Angular 1.x Solution

Page 15: Shadow dom  & Virtual dom
Page 16: Shadow dom  & Virtual dom
Page 17: Shadow dom  & Virtual dom
Page 18: Shadow dom  & Virtual dom

Shadow DOM Solution

Page 19: Shadow dom  & Virtual dom
Page 20: Shadow dom  & Virtual dom
Page 21: Shadow dom  & Virtual dom
Page 22: Shadow dom  & Virtual dom
Page 23: Shadow dom  & Virtual dom

Why should you care?

Page 24: Shadow dom  & Virtual dom
Page 25: Shadow dom  & Virtual dom
Page 26: Shadow dom  & Virtual dom
Page 27: Shadow dom  & Virtual dom
Page 28: Shadow dom  & Virtual dom

So what about Virtual DOM?

Page 29: Shadow dom  & Virtual dom
Page 30: Shadow dom  & Virtual dom

Virtual DOM + render();

Dirty Checking + $scope.$digest();

Page 31: Shadow dom  & Virtual dom

● Transclusion has limitations● Shadow DOM solves those problems and adds

encapsulation● Virtual DOM has nothing to do w/ Shadow

DOM & is for rapid data rendering

Page 32: Shadow dom  & Virtual dom

@scott_sword

scottsword

Demos

Standard http://jsbin.com/xijirileho/2/edit?html,output

Angular 1.x Solutionhttp://jsbin.com/yacixikubi/2/edit?html,js,output

Shadow DOM Solutionhttp://jsbin.com/cemasobefi/1/edit?html,output

Angular 2 Solutionhttps://github.com/boise-angularjs/quickstart

Presentation Slideshttp://www.slideshare.net/ScottSword/shadow-dom-virtual-dom