-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce a native namespace and skip certain handling and warnings
- Loading branch information
1 parent
9745b61
commit 96c027c
Showing
9 changed files
with
172 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,27 @@ | ||
export const html = 'http://www.w3.org/1999/xhtml'; | ||
export const mathml = 'http://www.w3.org/1998/Math/MathML'; | ||
export const native = 'http://svelte-native.technology/2019/native'; | ||
export const svg = 'http://www.w3.org/2000/svg'; | ||
export const xlink = 'http://www.w3.org/1999/xlink'; | ||
export const xml = 'http://www.w3.org/XML/1998/namespace'; | ||
export const xmlns = 'http://www.w3.org/2000/xmlns'; | ||
|
||
|
||
export const valid_namespaces = [ | ||
'html', | ||
'mathml', | ||
'native', | ||
'svg', | ||
'xlink', | ||
'xml', | ||
'xmlns', | ||
html, | ||
mathml, | ||
native, | ||
svg, | ||
xlink, | ||
xml, | ||
xmlns | ||
]; | ||
|
||
export const namespaces: Record<string, string> = { html, mathml, svg, xlink, xml, xmlns }; | ||
export const namespaces: Record<string, string> = { html, mathml, native, svg, xlink, xml, xmlns }; |
18 changes: 18 additions & 0 deletions
18
test/runtime/samples/attribute-casing-native-namespace/_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Test support for the native namespaces preserving attribute case (eg svelte-native, svelte-nodegui). | ||
|
||
export default { | ||
html: ` | ||
<page horizontalAlignment="center"> | ||
<button textWrap="true" text="button"> | ||
</page> | ||
`, | ||
options: { | ||
hydrate: false // Hydration test will fail as case sensitivity is only handled for svg elements. | ||
}, | ||
|
||
test({ assert, target }) { | ||
const attr = sel => target.querySelector(sel).attributes[0].name; | ||
assert.equal(attr('page'), 'horizontalAlignment'); | ||
assert.equal(attr('button'), 'textWrap'); | ||
} | ||
}; |
4 changes: 4 additions & 0 deletions
4
test/runtime/samples/attribute-casing-native-namespace/main.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<svelte:options namespace="native" /> | ||
<page horizontalAlignment="center"> | ||
<button textWrap="true" text="button"> | ||
</page> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<svelte:options namespace="native" /> | ||
<page> | ||
<a>not actually a link</a> | ||
<label>This isn't a html label</label> | ||
<figure>This is maybe a QT figure</figure> | ||
</page> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[] |
15 changes: 15 additions & 0 deletions
15
test/validator/samples/binding-invalid-native-namespace/errors.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[{ | ||
"code": "invalid-binding", | ||
"message": "'value' is not a valid binding. Native elements only support bind:this", | ||
"pos": 80, | ||
"start": { | ||
"line": 6, | ||
"column": 7, | ||
"character": 80 | ||
}, | ||
"end": { | ||
"line": 6, | ||
"column": 28, | ||
"character": 101 | ||
} | ||
}] |
6 changes: 6 additions & 0 deletions
6
test/validator/samples/binding-invalid-native-namespace/input.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<svelte:options namespace="native" /> | ||
<script> | ||
let whatever; | ||
</script> | ||
|
||
<input bind:value={whatever} /> |