w3c xbl 2.0 and widgets 1.0

35
Marcos Caceres [email protected]

Upload: marcos-caceres

Post on 11-May-2015

1.806 views

Category:

Technology


3 download

DESCRIPTION

TPAC Presentation

TRANSCRIPT

Page 1: W3C XBL 2.0 and Widgets 1.0

Marcos [email protected]

Page 2: W3C XBL 2.0 and Widgets 1.0

XBL 2.0 (15‐20mins)What does it do

Widgets ... Our definition of widgetWhat does it do..

How it works...Our definition of widgetSpec overviewIssues we want to Issues we want to discussPlease stop me to Please stop me to discuss stuff! 

Page 3: W3C XBL 2.0 and Widgets 1.0

XML Binding Language

Page 4: W3C XBL 2.0 and Widgets 1.0

What is XBL2?XBL Elements XBL Elements Binding attachment and detachment h dShadow Content

Implementations  and inheritancepEvent handlers DOM InterfacesDOM Interfaces

Page 5: W3C XBL 2.0 and Widgets 1.0

Redundant semantic free mark‐up (div elements  for example)elements, for example)Hard to add new interfaces/methods to lelements

Hard to capture events, particularly modified p p ykey eventsHard to move content in a document, Hard to move content in a document, especially from one medium to another

Page 6: W3C XBL 2.0 and Widgets 1.0

Log on Widget (minimal markup)

<form action="#example" method="post" id="loginWidget"> <fieldset> 

<legend>Log on</legend> <label for="usernameField">Username:</label> <input name="username" type="text"/> <label for="passwordField">Password:</label> <input type="password" name="password"/> <input name="submit" type="submit"/> p yp

</fieldset> </form>

Page 7: W3C XBL 2.0 and Widgets 1.0

No enough structureActual Markup needed for design:

<form action="#example" method="post" id="loginWidget"><fieldset> <legend>Log in</legend> <div id="loginBoxFields"> 

<div class="fieldGroup"> <div class= fieldGroup > <label for="usernameField" >Username:</label> <input name="username" type="text" id="usernameField" value=""/> 

</div> <div class="fieldGroup"> 

<label for="passwordField">Password:</label> <label for= passwordField >Password:</label> <input type="password" id="passwordField" name="password" value=""/> 

</div> </div> <div class="actionsContainer"> 

<div class="inputButtons"> <div class= inputButtons > <input name="submit" type="submit“ class="submitButton" value="Submit" /> 

</div> </div> </fieldset> 

</form> 

Page 8: W3C XBL 2.0 and Widgets 1.0

Designers need 2x the markup to achieve a designdesignMarkup needs to be polluted with 

ll l d lsemantically neutral div elementsXBL can fix this... And make the whole thing gbetter to use. 

Page 9: W3C XBL 2.0 and Widgets 1.0

DOM‐Based binding languageUsed to override (or enhance) standard Used to override (or enhance) standard behaviour and presentation of DOM elementsLets you: yAdd/move/replace/restyle contentAdd DOM interfaces to elementsAdd DOM interfaces to elementsAdd new stylesAdd event listenersAdd event listenersPreload media

No implementations yetNo implementations yet

Page 10: W3C XBL 2.0 and Widgets 1.0

HTML documentsAdd  ibilit   h  b h i   d Add accessibility, enhance behaviour and aesthetics

M l i di  Multimedia Add functionality Bring elements to life

Page 11: W3C XBL 2.0 and Widgets 1.0
Page 12: W3C XBL 2.0 and Widgets 1.0
Page 13: W3C XBL 2.0 and Widgets 1.0
Page 14: W3C XBL 2.0 and Widgets 1.0

BindingImplementation

Global Attributesxbl:pseudop e e tat o

Template▪ Content

b pseudo▪ For CSS pseudo selectors

xbl:attr▪ div▪ Inherited

Resources

▪ For forwarding attributes

Resources▪ Prefetch▪ Style

Handlers▪ Handler

ScriptScript

Page 15: W3C XBL 2.0 and Widgets 1.0

Same as HTML scriptDeclare global 

<script>var c = 0; Declare global 

functionsScoped to the XBL 

var c = 0; function magic(a,b ){

return a + b * c; Scoped to the XBL document

return a + b   c; }</script?></script?>

Page 16: W3C XBL 2.0 and Widgets 1.0

Allows you to define a binding:H  it b h  How it behaves If it extends other bindings (inheritance model will be discussed later)What content it adds when bound to another elementWhat resources it usesWhat resources it uses

Page 17: W3C XBL 2.0 and Widgets 1.0

Allows you to add new DOM interfaces

<binding element=“h1”><implementation>

Define new functionality for an objectDefine event handlers

({this.makeRed() =function(){}  

Define properties and fields}, this.onclick(e) = function{this.makeRed();

}})</implementation>/implementation

</binding>...<h1><h1>

Page 18: W3C XBL 2.0 and Widgets 1.0

TemplateContains a template of the 

<binding id=“reshuffle”><template>p

content to be inserted into a document

Content

<content includes=“b”/><content includes=“a”/></template>Content

Inserts the “selected” content of a bound l t

</template></binding>....

elementYou can only use a selected element once. 

<div id=“homepage”><h1 id=“a”>Welcome!</h1>h  id “b” M ’ The resulting DOM tree 

is called shadow content <h2 id=“b”>Marcos’ 

page</h1></div></div>

Page 19: W3C XBL 2.0 and Widgets 1.0

DIVUsed as a general container mechanism (like HTML div) 

<binding extends=“reshuffle”><template><div state=“idle”>

Has a “state” attributeInherited

Used to insert the content of an extended binding into another 

<inherited><h1>no one’s homepage</h1>extended binding into another 

binding. </h1></inherited>

<div></template>p

<resources> <style> div[state=idle]{

color: yellow; color: yellow; }</style>

</ resources></binding>

Page 20: W3C XBL 2.0 and Widgets 1.0

ResourcesStructural container

<binding><resources>Structural container

StyleStyles applied to a binding

esou ces<style>button:active{ y pp g

Author sheet styles can also be applied to a bi di

border: solid red;background: url(fancy.png);

bindingPrefetch

Primes the cache

}</style>

f h “f ”/Primes the cache <prefetch src=“fancy.png”/></resources></binding></binding>

Page 21: W3C XBL 2.0 and Widgets 1.0

Allows you to group event handlersTrap DOM events and re‐route 

The bound document is:

<hotspot message="Hello World"> pthem to functions defined in the <implementation>Fine‐grained control over keyboard and mouse events

p g<instruction> Activate this text. </instruction></hotspot> keyboard and mouse events </hotspot> 

The binding is:<binding> g<handlers> <handler event="click">alert(event currentTarget getAttribute(event.currentTarget.getAttribute('message' )); </handler> </handlers> </binding>

Page 22: W3C XBL 2.0 and Widgets 1.0

idevent

keykey‐locationevent

phasetrusted

key locationtextprev‐valuetrusted

propagatedefault‐action

prev valuenew‐valueattr‐namedefault action

buttonclick‐count

attr nameattr‐change 

click countmodifiers

Page 23: W3C XBL 2.0 and Widgets 1.0

Document attachmentProcessing Instruction

Binding DetachmentElement.removeBinding(URI)Processing Instruction

▪ <?xbl href="foo.xml"?>

New DOM interface

Element.removeBinding(URI)

New DOM interface▪ document.loadBindingDocument('foo.xml');

Element AttachmentElement AttachmentCSS▪ ‐xbl‐binding: url("foo.xml")g ( )

Binding element▪ <binding element="#x">g

Page 24: W3C XBL 2.0 and Widgets 1.0

Explicit inheritance Implicit inheritanceImplicit inheritance

Page 25: W3C XBL 2.0 and Widgets 1.0

client‐side web applications

Page 26: W3C XBL 2.0 and Widgets 1.0

Widget: client‐side Web applications for displaying and/or updating remote data  displaying and/or updating remote data, packaged in a way to allow a single download 

d ll l h dand installation on a client machine or device.

Page 27: W3C XBL 2.0 and Widgets 1.0
Page 28: W3C XBL 2.0 and Widgets 1.0

Widgets 1.0 addresses:Packaging (Zip)Packaging (Zip)▪ Digital signature, Internationalization (?)

BootstrappingBootstrappingConfiguration and Metadata APIAPIsAutomatic updatesRendering, UI, accessibility Security

Page 29: W3C XBL 2.0 and Widgets 1.0

Packaging formatFormat: Zip (64bit?) Compression (Deflate)Format: Zip (64bit?),Compression (Deflate)Is it effectively specified? (eg. For longevity?) 

Digital SignaturesDigital SignaturesXML Dig Sig: x.509 Certificates, tap into PKI, As quality assurance As quality assurance 

InternationalizationLeave it to the authors?Leave it to the authors?Make it folder based? What about Unicode folder names? What about Unicode folder names? 

Page 30: W3C XBL 2.0 and Widgets 1.0

Automatically instantiating a widgetModel(s)Model(s):Declarative ▪ <widget start=“/clock.svg”...>

Automatic (Fallback)▪ Find one of index.[html|htm|xhtml|xht|xml|svg]

Page 31: W3C XBL 2.0 and Widgets 1.0

Filename: config.xmlElements  Id  version  description  author (url  Elements: Id, version, description, author (url, email), title, start, icon, license, access 

k d l(network and plugins)Have we captured what developers want?p pFlexible processing modelWe want robust error handlingWe want robust error handling

Parsing rulesR b    h dli  (   l   i  )Robust error handling (not overly strict, )

Page 32: W3C XBL 2.0 and Widgets 1.0

ECMAScriptFollowing Dashboard’s APIs Following Dashboard s APIs XMLHTTPRequest

dCross‐widget messagingHTML‐5‐like model, also Yahoo!’s model5 ,

How does Widget object relate to Window? 

Page 33: W3C XBL 2.0 and Widgets 1.0

Not yet specifiedShould be able to handle offlineShould be able to handle offlineShould exploit existing HTTP cachingVersioningNumber based (1.2.3.4)( 3 4)String based (“1.0RC2 – Build 12345”)ComparisonComparison

Update URI

Page 34: W3C XBL 2.0 and Widgets 1.0

HTML, SVG, XML, CSSHow do we handle transparency? Rounded corners How do we handle transparency? Rounded corners and other irregular shapes? etc. 

Page 35: W3C XBL 2.0 and Widgets 1.0

Undefined (our elephant)What’s allowed? What s allowed? Eg. should we allow application execution?No origin? Do we allow cross‐site requests?