Skip to content

Commit

Permalink
Merge branch 'master' of github.com:sveltejs/svelte
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed Jul 2, 2019
2 parents bdda83f + f341bef commit 9883a50
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 11 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Svelte changelog

## 3.6.3

* Fix await block mounting inside removed if block ([#1496](https://github.com/sveltejs/svelte/issues/1496))
* Update when element references are removed ([#2034](https://github.com/sveltejs/svelte/issues/2034))
* Don't attempt to serialize non-string values in server-rendered bindings ([#2135](https://github.com/sveltejs/svelte/issues/2135))
* Recognise dependencies in function expressions ([#2693](https://github.com/sveltejs/svelte/issues/2693))
* Scope pseudo-class selectors without class/type ([#1705](https://github.com/sveltejs/svelte/issues/1705))
* Allow nested at-rules ([#3135](https://github.com/sveltejs/svelte/issues/3135))
* Allow attributes to contain `=` characters ([#3149](https://github.com/sveltejs/svelte/pull/3149))

## 3.6.2

* Fix placement of each-else block ([#2917](https://github.com/sveltejs/svelte/issues/2917))
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "svelte",
"version": "3.6.2",
"version": "3.6.3",
"description": "Cybernetically enhanced web apps",
"module": "index.mjs",
"main": "index",
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/compile/css/Stylesheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ export default class Stylesheet {

this.has_styles = true;

const stack: Array<Atrule> = [];
const stack: Atrule[] = [];
let depth = 0;
let current_atrule: Atrule = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default function bind_this(component: Component, block: Block, binding: B
: deindent`
${lhs} = $$value;
${component.invalidate(object)};
`
`;
}

const contextual_dependencies = Array.from(binding.expression.contextual_dependencies);
Expand Down
16 changes: 8 additions & 8 deletions src/compiler/preprocess/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ interface Processed {
dependencies?: string[];
}

function parse_attribute_value(value: string) {
return /^['"]/.test(value) ?
value.slice(1, -1) :
value;
}

function parse_attributes(str: string) {
const attrs = {};
str.split(/\s+/).filter(Boolean).forEach(attr => {
const [name, value] = attr.split('=');
attrs[name] = value ? parse_attribute_value(value) : true;
const p = attr.indexOf('=');
if (p === -1) {
attrs[attr] = true;
} else {
attrs[attr.slice(0, p)] = `'"`.includes(attr[p + 1]) ?
attr.slice(p + 2, -1) :
attr.slice(p + 1);
}
});
return attrs;
}
Expand Down
5 changes: 5 additions & 0 deletions test/preprocess/samples/attributes-with-equals/_config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default {
preprocess: {
style: ({ attributes }) => attributes.foo && attributes.foo.includes('=') ? { code: '' } : null
}
};
3 changes: 3 additions & 0 deletions test/preprocess/samples/attributes-with-equals/input.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<style foo="bar=baz">
foo {}
</style>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<style foo="bar=baz"></style>

0 comments on commit 9883a50

Please sign in to comment.