From b6e9574805886786589d020086710de287fbd058 Mon Sep 17 00:00:00 2001 From: Ivan Hofer Date: Sat, 14 Nov 2020 18:47:02 +0100 Subject: [PATCH] use snake_case for method names --- src/compiler/compile/render_dom/index.ts | 4 ++-- src/runtime/internal/Component.ts | 2 +- src/runtime/internal/dom.ts | 2 +- .../samples/collapses-text-around-comments/expected.js | 10 +++++----- test/js/samples/css-media-query/expected.js | 10 +++++----- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/compiler/compile/render_dom/index.ts b/src/compiler/compile/render_dom/index.ts index a32db46078..6c0070e635 100644 --- a/src/compiler/compile/render_dom/index.ts +++ b/src/compiler/compile/render_dom/index.ts @@ -45,7 +45,7 @@ export default function dom( if (should_add_css) { body.push(b` function ${add_css}(target) { - @appendStyleIfNotPresent(target, "${component.stylesheet.id.replace('svelte-', '')}", "${styles}"); + @append_style_if_not_present(target, "${component.stylesheet.id.replace('svelte-', '')}", "${styles}"); } `); } @@ -529,7 +529,7 @@ export default function dom( constructor(options) { super(${options.dev && 'options'}); - ${should_add_css && b`@addCssToComponent(this, ${add_css}, options);`} + ${should_add_css && b`@add_css_to_component(this, ${add_css}, options);`} @init(this, options, ${definition}, ${has_create_fragment ? 'create_fragment' : 'null'}, ${not_equal}, ${prop_indexes}, ${dirty}); ${options.dev && b`@dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "${name.name}", options, id: create_fragment.name });`} diff --git a/src/runtime/internal/Component.ts b/src/runtime/internal/Component.ts index 871d248969..52ab54fa8d 100644 --- a/src/runtime/internal/Component.ts +++ b/src/runtime/internal/Component.ts @@ -98,7 +98,7 @@ function make_dirty(component, i) { } -export function addCssToComponent(component, add_css, options) { +export function add_css_to_component(component, add_css, options) { component.$$ = { customStyleTag: options.customStyleTag || current_component && current_component.$$.customStyleTag }; diff --git a/src/runtime/internal/dom.ts b/src/runtime/internal/dom.ts index 08070c514a..4d4da3f7bd 100644 --- a/src/runtime/internal/dom.ts +++ b/src/runtime/internal/dom.ts @@ -1,6 +1,6 @@ import { has_prop } from './utils'; -export function appendStyleIfNotPresent( +export function append_style_if_not_present( target: Element, styleSheetId: string, styles: string, diff --git a/test/js/samples/collapses-text-around-comments/expected.js b/test/js/samples/collapses-text-around-comments/expected.js index 021baa10be..57b370d368 100644 --- a/test/js/samples/collapses-text-around-comments/expected.js +++ b/test/js/samples/collapses-text-around-comments/expected.js @@ -1,9 +1,9 @@ /* generated by Svelte vX.Y.Z */ import { SvelteComponent, - addCssToComponent, + add_css_to_component, append, - appendStyleIfNotPresent, + append_style_if_not_present, attr, detach, element, @@ -15,8 +15,8 @@ import { text } from "svelte/internal"; -function add_css(customStyleTag) { - appendStyleIfNotPresent(customStyleTag, "1a7i8ec", "p.svelte-1a7i8ec{color:red}"); +function add_css(target) { + append_style_if_not_present(target, "1a7i8ec", "p.svelte-1a7i8ec{color:red}"); } function create_fragment(ctx) { @@ -57,7 +57,7 @@ function instance($$self, $$props, $$invalidate) { class Component extends SvelteComponent { constructor(options) { super(); - addCssToComponent(this, add_css, options); + add_css_to_component(this, add_css, options); init(this, options, instance, create_fragment, safe_not_equal, { foo: 0 }); } } diff --git a/test/js/samples/css-media-query/expected.js b/test/js/samples/css-media-query/expected.js index 36b88810b8..6dde015826 100644 --- a/test/js/samples/css-media-query/expected.js +++ b/test/js/samples/css-media-query/expected.js @@ -1,8 +1,8 @@ /* generated by Svelte vX.Y.Z */ import { SvelteComponent, - addCssToComponent, - appendStyleIfNotPresent, + add_css_to_component, + append_style_if_not_present, attr, detach, element, @@ -12,8 +12,8 @@ import { safe_not_equal } from "svelte/internal"; -function add_css(customStyleTag) { - appendStyleIfNotPresent(customStyleTag, "1slhpfn", "@media(min-width: 1px){div.svelte-1slhpfn{color:red}}"); +function add_css(target) { + append_style_if_not_present(target, "1slhpfn", "@media(min-width: 1px){div.svelte-1slhpfn{color:red}}"); } function create_fragment(ctx) { @@ -39,7 +39,7 @@ function create_fragment(ctx) { class Component extends SvelteComponent { constructor(options) { super(); - addCssToComponent(this, add_css, options); + add_css_to_component(this, add_css, options); init(this, options, null, create_fragment, safe_not_equal, {}); } }