diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e8e1658629c..0a780fd8cf99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ # Svelte changelog +## 1.10.3 + +* Prevent `''` string occurence breaking pages ([#349](https://github.com/sveltejs/svelte/pull/349)) +* Allow reference to whitelisted globals without properties ([#333](https://github.com/sveltejs/svelte/pull/333)) +* Don't remove ` ` incorrectly ([#348](https://github.com/sveltejs/svelte/issues/348)) +* `let` -> `var` in `addCss` block ([#351](https://github.com/sveltejs/svelte/pull/351)) + +## 1.10.2 + +* Accept any case for doctype declarations ([#336](https://github.com/sveltejs/svelte/issues/336)) +* Allow non-top-level `' ) ) { + if ( parser.eat( '<\/script>' ) ) { break; } } diff --git a/src/parse/state/tag.js b/src/parse/state/tag.js index 09eda8da9cc1..c6007318af13 100644 --- a/src/parse/state/tag.js +++ b/src/parse/state/tag.js @@ -4,7 +4,7 @@ import readStyle from '../read/style.js'; import { readEventHandlerDirective, readBindingDirective } from '../read/directives.js'; import { trimStart, trimEnd } from '../utils/trim.js'; import { decodeCharacterReferences } from '../utils/html.js'; -import voidElementNames from '../../utils/voidElementNames.js'; +import isVoidElementName from '../../utils/isVoidElementName.js'; const validTagName = /^\!?[a-zA-Z]{1,}:?[a-zA-Z0-9\-]*/; const invalidUnquotedAttributeCharacters = /[\s"'=<>\/`]/; @@ -84,7 +84,7 @@ export default function tag ( parser ) { parser.allowWhitespace(); if ( isClosingTag ) { - if ( voidElementNames.test( name ) ) { + if ( isVoidElementName( name ) ) { parser.error( `<${name}> is a void element and cannot have children, or a closing tag`, start ); } @@ -130,13 +130,13 @@ export default function tag ( parser ) { parser.allowWhitespace(); - // special cases – + `; + + const { code } = svelte.compile( source, { + format: 'eval', + globals: { + answer: 'answer' + } + }); + + return testEval( code, 'Foo', { answer: 42 }, `
42
` ); + }); + }); }); diff --git a/test/generator/globals-accessible-directly/_config.js b/test/generator/globals-accessible-directly/_config.js new file mode 100644 index 000000000000..ee7e79fd174f --- /dev/null +++ b/test/generator/globals-accessible-directly/_config.js @@ -0,0 +1,7 @@ +export default { + html: '', + + test ( assert, component, target ) { + assert.htmlEqual( target.innerHTML, 'NaN' ); + } +}; diff --git a/test/generator/globals-accessible-directly/main.html b/test/generator/globals-accessible-directly/main.html new file mode 100644 index 000000000000..349b4b1d3292 --- /dev/null +++ b/test/generator/globals-accessible-directly/main.html @@ -0,0 +1 @@ +{{NaN}} diff --git a/test/generator/nbsp/_config.js b/test/generator/nbsp/_config.js new file mode 100644 index 000000000000..c09c14e7c413 --- /dev/null +++ b/test/generator/nbsp/_config.js @@ -0,0 +1,8 @@ +export default { + html: ` `, + + test ( assert, component, target ) { + const text = target.querySelector( 'span' ).textContent; + assert.equal( text.charCodeAt( 0 ), 160 ); + } +}; \ No newline at end of file diff --git a/test/generator/nbsp/main.html b/test/generator/nbsp/main.html new file mode 100644 index 000000000000..11cd588757a4 --- /dev/null +++ b/test/generator/nbsp/main.html @@ -0,0 +1 @@ +  \ No newline at end of file diff --git a/test/parser/error-multiple-styles/error.json b/test/parser/error-multiple-styles/error.json index 6a8b184ed675..421c5558a77b 100644 --- a/test/parser/error-multiple-styles/error.json +++ b/test/parser/error-multiple-styles/error.json @@ -1,5 +1,5 @@ { - "message": "You can only have one