Skip to content

Commit 1330142

Browse files
authored
support sapper-noscroll (#438)
* support sapper-noscroll * fix typo and tweak
1 parent bc7c0ff commit 1330142

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

packages/svelte2tsx/src/htmlxtojsx/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,13 +355,14 @@ export function convertHtmlxToJsx(
355355
//if we are on an "element" we are case insensitive, lowercase to match our JSX
356356
if (parent.type == 'Element') {
357357
//skip Attribute shorthand, that is handled below
358+
const sapperNoScroll = attr.name === 'sapper:noscroll';
358359
if (
359360
attr.value !== true &&
360361
!(
361362
attr.value.length &&
362363
attr.value.length == 1 &&
363364
attr.value[0].type == 'AttributeShorthand'
364-
)
365+
) || sapperNoScroll
365366
) {
366367
let name = attr.name;
367368
if (!svgAttributes.find((x) => x == name)) {

packages/svelte2tsx/svelte-jsx.d.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,9 +697,13 @@
697697
onrejectionhandled?: EventHandler<PromiseRejectionEvent, Window>;
698698
}
699699

700+
interface SapperAnchorProps {
701+
sapperNoscroll?: true;
702+
}
703+
700704
interface IntrinsicElements {
701705
// HTML
702-
a: HTMLProps<HTMLAnchorElement>;
706+
a: HTMLProps<HTMLAnchorElement> & SapperAnchorProps;
703707
abbr: HTMLProps<HTMLElement>;
704708
address: HTMLProps<HTMLElement>;
705709
area: HTMLProps<HTMLAreaElement>;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<><a sapperNoscroll></a></>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<a sapper:noscroll></a>

0 commit comments

Comments
 (0)