@ -25,9 +25,9 @@ import { escape_html } from '../../../../../../escaping.js';
const WHITESPACE _INSENSITIVE _ATTRIBUTES = [ 'class' , 'style' ] ;
const WHITESPACE _INSENSITIVE _ATTRIBUTES = [ 'class' , 'style' ] ;
/ * *
/ * *
* Writes the output to the template output . Some elements may have attributes on them that require the
* Writes the output to the template output . Some elements may have attributes on them that require
* their output to be the child content instead . In this case , an object is returned .
* their output to be the child content instead . In this case , an object is returned .
* @ param { AST . RegularElement | AST . SvelteElement } node
* @ param { AST . RegularElement | AST . SvelteElement | AST . TitleElement } node
* @ param { import ( 'zimmerframe' ) . Context < AST . SvelteNode , ComponentServerTransformState > } context
* @ param { import ( 'zimmerframe' ) . Context < AST . SvelteNode , ComponentServerTransformState > } context
* /
* /
export function build _element _attributes ( node , context ) {
export function build _element _attributes ( node , context ) {
@ -203,7 +203,7 @@ export function build_element_attributes(node, context) {
if ( has _spread ) {
if ( has _spread ) {
build _element _spread _attributes ( node , attributes , style _directives , class _directives , context ) ;
build _element _spread _attributes ( node , attributes , style _directives , class _directives , context ) ;
} else {
} else {
const css _hash = node . metadata. scoped ? context . state . analysis . css . hash : null ;
const css _hash = node . type !== 'TitleElement' && node . metadata. scoped ? context . state . analysis . css . hash : null ;
for ( const attribute of /** @type {AST.Attribute[]} */ ( attributes ) ) {
for ( const attribute of /** @type {AST.Attribute[]} */ ( attributes ) ) {
const name = get _attribute _name ( node , attribute ) ;
const name = get _attribute _name ( node , attribute ) ;
@ -273,12 +273,12 @@ export function build_element_attributes(node, context) {
}
}
/ * *
/ * *
* @ param { AST . RegularElement | AST . SvelteElement } element
* @ param { AST . RegularElement | AST . SvelteElement | AST . TitleElement } element
* @ param { AST . Attribute } attribute
* @ param { AST . Attribute } attribute
* /
* /
function get _attribute _name ( element , attribute ) {
function get _attribute _name ( element , attribute ) {
let name = attribute . name ;
let name = attribute . name ;
if ( ! element . metadata . svg && ! element . metadata . mathml ) {
if ( element . type !== 'TitleElement' && ! element . metadata . svg && ! element . metadata . mathml ) {
name = name . toLowerCase ( ) ;
name = name . toLowerCase ( ) ;
// don't lookup boolean aliases here, the server runtime function does only
// don't lookup boolean aliases here, the server runtime function does only
// check for the lowercase variants of boolean attributes
// check for the lowercase variants of boolean attributes
@ -288,7 +288,7 @@ function get_attribute_name(element, attribute) {
/ * *
/ * *
*
*
* @ param { AST . RegularElement | AST . SvelteElement } element
* @ param { AST . RegularElement | AST . SvelteElement | AST . TitleElement } element
* @ param { Array < AST . Attribute | AST . SpreadAttribute > } attributes
* @ param { Array < AST . Attribute | AST . SpreadAttribute > } attributes
* @ param { AST . StyleDirective [ ] } style _directives
* @ param { AST . StyleDirective [ ] } style _directives
* @ param { AST . ClassDirective [ ] } class _directives
* @ param { AST . ClassDirective [ ] } class _directives
@ -330,11 +330,13 @@ function build_element_spread_attributes(
styles = b . object ( properties ) ;
styles = b . object ( properties ) ;
}
}
if ( element . type !== 'TitleElement' ) {
if ( element . metadata . svg || element . metadata . mathml ) {
if ( element . metadata . svg || element . metadata . mathml ) {
flags |= ELEMENT _IS _NAMESPACED | ELEMENT _PRESERVE _ATTRIBUTE _CASE ;
flags |= ELEMENT _IS _NAMESPACED | ELEMENT _PRESERVE _ATTRIBUTE _CASE ;
} else if ( is _custom _element _node ( element ) ) {
} else if ( is _custom _element _node ( element ) ) {
flags |= ELEMENT _PRESERVE _ATTRIBUTE _CASE ;
flags |= ELEMENT _PRESERVE _ATTRIBUTE _CASE ;
}
}
}
const object = b . object (
const object = b . object (
attributes . map ( ( attribute ) => {
attributes . map ( ( attribute ) => {
@ -353,7 +355,7 @@ function build_element_spread_attributes(
) ;
) ;
const css _hash =
const css _hash =
element . metadata. scoped && context . state . analysis . css . hash
element . type !== 'TitleElement' && element . metadata. scoped && context . state . analysis . css . hash
? b . literal ( context . state . analysis . css . hash )
? b . literal ( context . state . analysis . css . hash )
: b . null ;
: b . null ;