ajklein / webkit Goto Github PK
View Code? Open in Web Editor NEWThis project forked from webkit/webkit-http
Unofficial mirror of the WebKit SVN repository
Home Page: http://www.webkit.org/
This project forked from webkit/webkit-http
Unofficial mirror of the WebKit SVN repository
Home Page: http://www.webkit.org/
right now it's not much of an API, just a convention
example test case that crashes (due to not having the proper v8::Context available):
<!DOCTYPE html>
<body>
<script>
if (window.testRunner) {
testRunner.waitUntilDone();
testRunner.dumpAsText();
setTimeout(function() { testRunner.notifyDone() }, 1000);
}
document.body.model = [{key: 1}, {key: 2}, {key: 3}];
</script>
<div>Below, there should be a list of three items.</div>
<ol>
<template iterate>
<li>{{key}}
</template>
</ol>
</body>
Fix is likely to pass a ScriptState to ScriptValue::toString and actually make use of it.
Right now, .model and .modelDelegate are in NodeRareData as strong references (in a ScriptValue). This will cause memory leaks if the model or modelDelegate have a reference back to the DOM. The easiest solution will be to move them to the JS wrapper, and store them in either internal fields or (more likely) hidden properties.
This is useful in cases where we want to replace on element with another (e.g., WebComponent upgrade) and need to copy bindings from one place to another. We already have addBinding(), so the obvious thing to add is getBindings().
This is consistent with the "strong connection" view of templates and instances
HTMLTemplateElement.cpp, addTextBinding, line 94
if (index != notFound && text->data().find("}}"))
this should be find("}}", index + 2) or we would match strings like this " abc }} def {{ ghi"
I should really just create my own clone and do pull requests.
e.g.
<body>
<script>
document.body.model = [1, 2];
</script>
<template iterate>
Foo
</template>
should cause two instances to be produced
The idea is that a template needs to take with it it's internal state (what model it's current iterator is pointing at, and how many instances it thinks it has), and it's instance nodes need to clone their terminators.
Something like go() and stop(). go() would cause the template to synchronously begin processing (instantiating or iterating). stop() would cause the template to synchronously tear itself down (useful if the template is to be moved elsewhere in the tree, to avoid double-stamping).
Removing it was a mistake. If template parses special, it needs to serialize special a well (they should be symmetric).
It's fine that appendChild, etc... have different behavior. The goal here is that template contents serialize but aren't in the parent/child hierarchy.
which property escape binding content based on the type of the attribute content
It may be that this is left to delegates to implement, but if so, we need tests showing that it is possible.
Template's should be able to iterate or instantiate, and reference their prototype DOM from another template element.
Right now, model value is blinding forwarded across to the ShadowRoot. This was just something simple to get working initially, but in retrospect has some elegance to it. Specifically, it leaves the implementation of the component in full control of what happens. E.g. If the component actually wants to blindly accept the model it can do that. If it wants to "alias" path values to internal path values, it can initially set it's root model as null, require some kind of attribute API which declares explicit bindings and then synthesize an internal model based on the bindings.
In any case, it's worth either making a test that asserts this pattern is workable or coming up with a different design.
Source/WebCore/mdv/ScriptValueBinding.cpp line 147
if (pathValues.hasNoValue() || !result.isObject())
return false;
should be
if (pathValues.hasNoValue() || !pathValues.isObject())
return false;
I guess if I return a delegate with a non object this is observable
In HTMLTemplateElement.cpp near line 214:
Element* element = m_template->treeScope()->getElementById(m_template->fastGetAttribute(refAttr));
This does not work correctly since we might need to check both the ownerDocument of the template element as well as the template contents owner
Maybe an example will show what I mean.
<template id=a>...</template>
<template>
<template id=b>...</template>
<template ref=a>...</template>
<template ref=b>...</template>
</template>
Also see https://code.google.com/p/mdv/source/browse/template_element.js#510
This requires synthesizing "splice" operations and transforming the existing array expansion from the old state to the new state with the fewest removals, additions. also, this should be willing to re-order existing instances. e..g
an iteration based on an array which is sorted should neither create nor destroy instances.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.