0
0
mirror of https://github.com/sveltejs/svelte.git synced 2024-11-30 00:46:29 +01:00
Commit Graph

121 Commits

Author SHA1 Message Date
Admin
622e7b0190 Adds debug all option to debug tag 2018-08-08 00:36:52 -05:00
Admin
89412e370e Adds validation for invalid reference names like foo-bar. 2018-08-05 00:29:38 -05:00
Christian Kaisermann
19d541ab77 Add refs.* to valid event handler callees warning message 2018-06-06 14:32:34 -03:00
Conduitry
5e8a8b95e5 update some stray references to v1 syntax 2018-05-27 15:48:21 -04:00
Rich Harris
94206ca439 add animation validation tests 2018-05-13 18:43:48 -04:00
Rich Harris
4a67542bec prevent bind:offsetWidth etc on void elements 2018-04-30 08:57:50 -04:00
Rich Harris
fe4637305b add validation logic, error on dimension bindings for SVG elements 2018-04-29 20:00:02 -04:00
Rich Harris
aaab6853ce support $method(...) calls, and warn on store.method(...) 2018-04-18 23:35:22 -04:00
Rich Harris
5a457bfb87 rename loc to start, include character info in locations 2018-04-16 21:50:57 -04:00
Rich Harris
b9fcc16d68 update test 2018-04-16 20:53:17 -04:00
Rich Harris
73e83e5571 tidy up 2018-04-16 00:05:51 -04:00
Rich Harris
cae4dd93bf fix some more tests 2018-04-16 00:03:22 -04:00
Rich Harris
39ad124c99 update validation tests 2018-04-15 23:06:57 -04:00
Rich Harris
1143b0a991 remove v1 tests 2018-04-15 22:19:05 -04:00
Rich Harris
80e0dceb9a remove validate and Stylesheet from public API 2018-04-15 19:57:12 -04:00
Rich Harris
c1573dbf2c implement onstate and onupdate 2018-04-15 13:09:59 -04:00
Rich Harris
410f44dced Merge branch 'master' into gh-1197 2018-04-15 11:30:48 -04:00
Rich Harris
33afb7e49a add some onstate/onupdate tests 2018-04-15 11:30:36 -04:00
Rich Harris
35f4a1f063 add codes to errors 2018-04-15 10:31:23 -04:00
Rich Harris
b86a1edb52 add codes to validation errors 2018-04-15 00:06:27 -04:00
Rich Harris
f0b2cb99f2 add codes to warnings (#474) 2018-04-14 21:38:37 -04:00
Rich Harris
813e077ccc
Merge pull request #1330 from sveltejs/gh-1318
implement syntax changes
2018-04-14 18:18:36 -04:00
Rich Harris
0edbac615c add validator tests 2018-04-12 23:34:46 -04:00
Rich Harris
032083bb34 fix #1331 2018-04-11 21:31:42 -04:00
Rich Harris
0ebe5355e1
Merge pull request #1299 from sveltejs/gh-1257
Stats
2018-04-08 10:05:31 -07:00
Rich-Harris
dfc8462d98 fail validation if bound <select> has dynamic multiple attribute - fixes #1270 2018-04-04 08:29:54 -04:00
Rich-Harris
c0287f2080 include warnings in stats object 2018-04-01 14:25:33 -04:00
Josh Duff
864fd313bb Accept backtick string literals in tag/props properties 2018-03-28 16:12:38 -05:00
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.
2018-03-19 15:23:27 -06:00
James Birtles
89024177fc Fix named-export end position 2018-03-18 17:22:46 +00:00
James Birtles
da6a74016f add end position to errors 2018-03-16 03:42:30 +00:00
James Birtles
d07721cd50 add end position to warnings 2018-03-16 03:42:29 +00:00
Rich Harris
fdd9adab4d add test for #1179 2018-02-23 08:40:02 -05:00
Rich Harris
f77314f647 increase test coverage 2018-02-10 23:29:47 -05:00
Rich Harris
bc6ee3ef9f increase test coverage, handle immediately-closed blocks 2018-02-10 22:08:39 -05:00
Rich Harris
198f132b28 doh 2018-02-10 11:51:24 -05:00
Rich Harris
ff67b137c4 empty blocks are a dev warning, not an error 2018-02-10 11:46:23 -05:00
Rich Harris
d0be845190
Merge pull request #1106 from sveltejs/gh-1083
Enforce valid names for computed properties
2018-01-18 11:48:40 -05:00
Conduitry
49135161bc do not run a11y validation on child component elements (#1110) 2018-01-16 14:39:56 -05:00
Rich Harris
b19303679d simplify test slightly, add test for reserved words 2018-01-13 22:44:45 -05:00
Rich Harris
146327e87f fix expected error position, tweak expected message to include suggested alternative 2018-01-13 20:06:29 -05:00
Rich Harris
cfdc8902ab run prettier (spaces -> tabs) 2018-01-13 20:05:27 -05:00
asweingarten
02afdb03fa [1083] Svelte should throw a compile time error when illegal characters are used in computed names
Approach:
  For each property name, construct a string that defines a function and see if parsing that string with Acorn throws an exception.
  If it does, assemble an informative error message that states which property is invalid, the first invalid character, and the location of that character within the name.

Changes to codebase:
- Added new validator test
"properties-computed-must-be-valid-function-names"
- Added new check into src/validate/js/propValidators/computed.ts,
"checkForValidIdentifiers"
  - this check was added to
  src/validate/js/utils/checkForValidIdentifiers.ts like the other
  checks in "computed.ts"
2018-01-11 17:48:25 -08:00
Rich Harris
5fea63a5de validate contents of await blocks (#1061) 2018-01-10 22:04:49 -05:00
Emil Ajdyna
5659d10d7c Allow xlink:href attribute 2018-01-05 20:15:21 +01:00
Rich Harris
b7d8c49dc8
Merge branch 'master' into gh-1027 2017-12-30 10:48:34 -05:00
Rich Harris
646b0c0e01 optimise <title> - fixes #1027 2017-12-24 15:09:38 -05:00
Rich Harris
ab94066932 warn on unused events/transitions - fixes #1051 2017-12-24 13:59:21 -05:00
Rich Harris
146f645502 detect unused/misplaced components - closes #1039 2017-12-24 13:38:57 -05:00
Rich Harris
4b87d20b93 tweak error wording slightly 2017-12-24 08:51:38 -05:00