-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
revert #3723, add special case for src attributes
- Loading branch information
Showing
5 changed files
with
116 additions
and
5 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export default { | ||
options: { | ||
hydratable: true | ||
} | ||
}; |
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,90 @@ | ||
/* generated by Svelte vX.Y.Z */ | ||
import { | ||
SvelteComponent, | ||
attr, | ||
children, | ||
claim_element, | ||
claim_space, | ||
detach, | ||
element, | ||
init, | ||
insert, | ||
noop, | ||
safe_not_equal, | ||
space | ||
} from "svelte/internal"; | ||
|
||
function create_fragment(ctx) { | ||
let img0; | ||
let img0_src_value; | ||
let t; | ||
let img1; | ||
let img1_src_value; | ||
|
||
return { | ||
c() { | ||
img0 = element("img"); | ||
t = space(); | ||
img1 = element("img"); | ||
this.h(); | ||
}, | ||
l(nodes) { | ||
img0 = claim_element(nodes, "IMG", { alt: true, src: true }); | ||
var img0_nodes = children(img0); | ||
img0_nodes.forEach(detach); | ||
t = claim_space(nodes); | ||
img1 = claim_element(nodes, "IMG", { alt: true, src: true }); | ||
var img1_nodes = children(img1); | ||
img1_nodes.forEach(detach); | ||
this.h(); | ||
}, | ||
h() { | ||
attr(img0, "alt", "potato"); | ||
if (img0.src !== (img0_src_value = ctx.url)) attr(img0, "src", img0_src_value); | ||
attr(img1, "alt", "potato"); | ||
if (img1.src !== (img1_src_value = "" + (ctx.slug + ".jpg"))) attr(img1, "src", img1_src_value); | ||
}, | ||
m(target, anchor) { | ||
insert(target, img0, anchor); | ||
insert(target, t, anchor); | ||
insert(target, img1, anchor); | ||
}, | ||
p(changed, ctx) { | ||
if (changed.url && img0.src !== (img0_src_value = ctx.url)) { | ||
attr(img0, "src", img0_src_value); | ||
} | ||
|
||
if (changed.slug && img1.src !== (img1_src_value = "" + (ctx.slug + ".jpg"))) { | ||
attr(img1, "src", img1_src_value); | ||
} | ||
}, | ||
i: noop, | ||
o: noop, | ||
d(detaching) { | ||
if (detaching) detach(img0); | ||
if (detaching) detach(t); | ||
if (detaching) detach(img1); | ||
} | ||
}; | ||
} | ||
|
||
function instance($$self, $$props, $$invalidate) { | ||
let { url } = $$props; | ||
let { slug } = $$props; | ||
|
||
$$self.$set = $$props => { | ||
if ("url" in $$props) $$invalidate("url", url = $$props.url); | ||
if ("slug" in $$props) $$invalidate("slug", slug = $$props.slug); | ||
}; | ||
|
||
return { url, slug }; | ||
} | ||
|
||
class Component extends SvelteComponent { | ||
constructor(options) { | ||
super(); | ||
init(this, options, instance, create_fragment, safe_not_equal, { url: 0, slug: 0 }); | ||
} | ||
} | ||
|
||
export default Component; |
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 @@ | ||
<script> | ||
export let url; | ||
export let slug; | ||
</script> | ||
|
||
<img alt="potato" src={url}> | ||
<img alt="potato" src="{slug}.jpg"> |