Rich Harris
956f318bea
while we're here, update parser output files
6 years ago
Rich Harris
4a88c9ccb5
remove -bundle files
6 years ago
Rich Harris
9031c16905
[WIP] Refactor, change where validation occurs ( #1721 )
...
Refactor, change where validation occurs
6 years ago
James Birtles
df4ca0103d
fix test
6 years ago
Rich Harris
98e63b37e9
groundwork for animations ( #1431 )
7 years ago
Rich Harris
b381aa63a4
integrate CLI - fixes #1360
7 years ago
Rich Harris
506ab3952e
destructuring
7 years ago
Rich Harris
8dc17b77db
allow arbitrary expressions in each block keys - fixes #703
7 years ago
Rich Harris
4c9ba2ef71
update parser tests
7 years ago
Rich Harris
5a457bfb87
rename loc to start, include character info in locations
7 years ago
Rich Harris
73e83e5571
tidy up
7 years ago
Rich Harris
286cabaf63
oops
7 years ago
Rich Harris
21168bf5f1
remove v1 parser tests
7 years ago
Rich Harris
35f4a1f063
add codes to errors
7 years ago
Rich Harris
7576d7dc93
update keyed each block syntax
7 years ago
Rich Harris
9bba8d18d1
implement dynamic components etc
7 years ago
Rich Harris
cb514afde4
more tests, support svelte: elements
7 years ago
Rich Harris
258466ebbe
attribute shorthand
7 years ago
Rich-Harris
90a372ebf3
brute force new keyed each block syntax
7 years ago
Rich-Harris
cc0055cf82
update parser for v2
7 years ago
Rich-Harris
eebd47d02b
add v2 parser tests, handle single curly tags
7 years ago
Rich-Harris
416fc0c81b
include spread with other attributes
7 years ago
Rich-Harris
d0c696bb2b
merge master -> mrkishi-spreadh
7 years ago
Jacob Wright
04f5d5c975
Adds actions to components
...
Actions add additional functionality to elements within your component's template that may be difficult to add with other mechanisms. Examples of functionality which actions makes trivial to attach are:
* tooltips
* image lazy loaders
* drag and drop functionality
Actions can be added to an element with the `use` directive.
```html
<img use:lazyload data-src="giant-photo.jpg>
```
Data may be passed to the action as an object literal (e.g. `use:b="{ setting: true }"`, a literal value (e.g. `use:b="'a string'"`), or a value or function from your component's state (e.g. `add:b="foo"` or `add:b="foo()"`).
Actions are defined in a "actions" property on your component definition.
```html
<script>
export default {
actions: {
b(node, data) {
// do something
return {
update(data) {},
destroy() {}
}
}
}
}
</script>
```
A action is a function which receives a reference to an element and optionally the data if it is added in the HTML. This function can then attach listeners or alter the element as needed. The action can optionally return an object with the methods `update(data)` and `destroy()`.
When data is added in the HTML and comes from state, the action's `update(data)` will be called if defined whenever the state is changed.
When the element is removed from the DOM `destroy()` will be called if provided, allowing for cleanup of event listeners, etc.
See https://github.com/sveltejs/svelte/issues/469 for discussion around this feature and more examples of how it could be used.
7 years ago
mrkishi
b5102f4f1b
Add spread -- rough idea
7 years ago
Rich Harris
39694c31c3
nicer error messages
7 years ago
Rich Harris
f97036dd39
error if ref:foo has a value
7 years ago
Jacob Wright
6d4f8d889a
Refactor directive parsing for code reuse
...
This removes the copy-pasta for directive parsing and removes the need for special if-else cases for each directive.
7 years ago
Rich Harris
ff67b137c4
empty blocks are a dev warning, not an error
7 years ago
Rich Harris
a4d08c205a
error on unclosed comments and blocks with only whitespace
7 years ago
Christopher Pfohl
b55ccc6d9f
Make sure scripts are passing good data so it's only the parse that can go wrong
7 years ago
Christopher Pfohl
c62f77a5d2
Empty Each Blocks should have consistent behavior.
...
Here the `error-each-blocks-empty` behaves as expected. It throws a ParseError.
I can't get the whitespace errors to repro in the tests. They're easily seen
here: https://svelte.technology/repl?version=1.51.0&gist=e1596f9631619a689e85c80e46506692
If you uncomment each section in sequence it demonstrates the behavior. I can't
quite figure out why my examples don't work.
7 years ago
Rich Harris
80c55b1e51
oops
7 years ago
Rich Harris
a85b09ea97
handle wacky identifier names in templates
7 years ago
Rich Harris
20962f9d82
add option to disable two-way binding ( #54 )
7 years ago
Efthymis Sarmpanis
e3b5f5250e
Failing test for improper toString override in CompileError
7 years ago
Rich Harris
5904a647db
support dynamic import - closes #1003
7 years ago
Rich Harris
0d42ff84db
fix tests, finish renaming stuff
7 years ago
Rich Harris
4f991536d4
parse :Switch tags
7 years ago
Rich Harris
d783993d23
halfway there
7 years ago
Rich Harris
908fe2ab7a
parse await-then-catch
7 years ago
Jacob Mischka
5d27d3fda7
Add array destructuring for each contexts
...
Fixes #888
7 years ago
Rich Harris
7a8c8fd577
replace {{yield}} with <slot/>
7 years ago
Rich Harris
82559c3775
support ref:foo as a CSS selector ( #693 )
7 years ago
Rich Harris
c98e1f49d3
update parser tests
7 years ago
Rich Harris
c4ad36023c
move whitespace logic out of parse and into preprocess
7 years ago
Rich Harris
135f626395
include ast in svelte.compile return value ( #632 )
8 years ago
Rich Harris
10ecd81734
prettierfy test files
8 years ago
Rich Harris
d752959ef1
change error message for invalid bindings
8 years ago
Rich Harris
5ccc200222
separate parsing rules for textareas
8 years ago
Rich-Harris
53c5c32da3
allow parameter-less transitions
8 years ago
Rich-Harris
2784ae0ade
parse transition directives
8 years ago
Rich-Harris
75e8d6205e
better error for bind:value="{{foo}}" - fixes #437
8 years ago
Rich-Harris
05ea031895
prevent unclosed <script> causing infinite loop
8 years ago
Rich-Harris
fc646925db
make it easier to run parser tests solo
8 years ago
Rich-Harris
4360a03ffd
parse <:Window> tags
8 years ago
Rich Harris
efce7acabe
Merge pull request #385 from sveltejs/gh-383
...
allow reserved words in tags e.g. {{class}}
8 years ago
Rich Harris
854a37c0d7
allow reserved words in tags e.g. {{class}} ( #383 )
8 years ago
Rich Harris
e6d088d753
implement :shorthand attributes
8 years ago
Rich Harris
5866a99b9a
treat binding values as expressions
8 years ago
Rich-Harris
60ed068a59
move tests around to facilitate registering babel based on environment
8 years ago
Rich Harris
a362b436b2
Merge pull request #352 from sveltejs/gh-348
...
differentiate between nbsp and other whitespace
8 years ago
Rich-Harris
ce6178d281
differentiate between nbsp and other whitespace ( #348 )
8 years ago
Conduitry
63d9f058f3
fix test
8 years ago
Rich-Harris
0f60242bb9
self-references ( #51 )
8 years ago
Rich-Harris
e480103de0
better errors for malformed event handlers ( #220 )
8 years ago
Rich Harris
2efd532563
better error for unmatched closing tag ( #321 )
8 years ago
Rich Harris
f85e343a9f
more informative error message when elements/blocks are left open ( #258 )
8 years ago
Rich Harris
0f2f309ff6
handle implicitly closed elements
8 years ago
Rich Harris
3e6e5e5304
normalise CSS parse errors
8 years ago
Rich Harris
2d5fd6f3a5
work around some css-tree quirks
8 years ago
Rich Harris
27579cd668
include CSS AST in svelte.parse output
8 years ago
Matt Steitle
1b16c02fe0
dontThrowParseErrorOnDoctypeDeclaration: Adding unit test for doctype tag
8 years ago
Rich-Harris
fc977a2abe
provide useful feedback on encountering void element closing tag
8 years ago
Rich-Harris
8340583fa1
parse @id for keyed each blocks ( #81 )
8 years ago
Rich-Harris
a72955faa2
fix typo, disallow multiple style/script tags
8 years ago
Fabrice Weinberg
75cf9d16ce
Make sure parser only allows unique attribute names
8 years ago
Rich Harris
f5b78e406c
Merge pull request #122 from sveltejs/each-else
...
Support {{#each}}-{{else}}
8 years ago
Arpad Borsos
9187c2dd09
add parser support for raw mustache tags
8 years ago
Arpad Borsos
fec55a1ccd
add each-else support to parser
8 years ago
Fabrice Weinberg
4bcbdfb5ae
Parse {{yield}} as YieldTag
8 years ago
Rich-Harris
90fac61d2a
use decodeCharacterReferences in text.js, not tag.js
8 years ago
Fabrice Weinberg
4b9832f03a
Convert entities of all text nodes
8 years ago
Rich Harris
e4a9344bdb
Merge pull request #70 from sveltejs/gh-64
...
handle trailing comments in script tags
8 years ago
Rich Harris
db65f01ee3
handle trailing comments in script tags – closes #64
8 years ago
Arpad Borsos
8518065c97
also trim whitespace from elseif/else blocks
8 years ago
Rich-Harris
817d371826
fix readUntil infinite loop bug
8 years ago
Rich-Harris
2741eee8bf
bind:foo shorthand – closes #20
8 years ago
Rich-Harris
b1b47696b1
implement elseif
8 years ago
Rich-Harris
77b600d726
add {{else}} tests
8 years ago
Rich-Harris
632a980948
wrap script block in IIFE to prevent pollution
8 years ago
Rich-Harris
370db7d269
scoped css
8 years ago
Rich-Harris
0d4728faf2
fix entities in attributes
8 years ago
Rich-Harris
4ce0f2fd58
handle unquoted attribute values
8 years ago
Rich-Harris
1eb3b7373e
test inline expression parse errors
8 years ago
Rich-Harris
4e3e6a45b6
test leading whitespace in template
8 years ago
Rich-Harris
a82b2e9e05
add parser.error coverage
8 years ago
Rich-Harris
c205761fe1
rename .svelte to .html in test files - better idea i think
8 years ago
Rich-Harris
44a2fd31f6
refs
8 years ago
Rich-Harris
fa60968ae1
basic two-way binding
8 years ago