https://saxonica.plan.io/https://saxonica.plan.io/favicon.ico2018-02-28T11:20:43ZSaxonica Developer CommunitySaxonJS - Bug #3704: Issues with ixsl:style()https://saxonica.plan.io/issues/3704?journal_id=112612018-02-28T11:20:43ZDebbie Lockettdebbie@saxonica.com
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>In Progress</i></li></ul><p>In the implementation of ixsl:style() in ExtraFn.js, we now explicitly construct a HashTrie, representing the CSS property-value pairs from the CSSStyleDeclaration object. The resulting XDM map has type map(xs:string, xs:string?)</p>
<p>For information, here are details of the relevant properties of the CSSStyleDeclaration object:</p>
<ul>
<li>
<p>CSSStyleDeclaration.length property returns the number of property-value pairs;</p>
</li>
<li>
<p>CSSStyleDeclaration.item() returns the property name by index;</p>
</li>
<li>
<p>CSSStyleDeclaration.getPropertyValue() returns the property value given a property name.</p>
</li>
</ul>
<p>If a CSSStyleDeclaration property value is null or undefined, then the corresponding value in the XDM map is an empty sequence. Otherwise property values are always strings.</p>
<p>Note that the CSS property names are in kebab-case (e.g. font-size), and so the property names in the XDM map returned by ixsl:style() will be in kebab-case. But to set style properties, camel-case must be used: e.g. fontSize (since to set the font size on an HTMLElement elt, you use elt.style.fontSize). This results in some mismatch for style property names used for getting and setting (inherited by IXSL from JavaScript):</p>
<pre><code><xsl:template match="div[@id='list']//li" mode="ixsl:onmouseover">
<xsl:if test="ixsl:style(.)?font-size = '12px'">
<ixsl:set-style name="fontSize" select="'20px'"/>
</xsl:if>
</xsl:template>
</code></pre>
<p>We could perhaps do more to convert style property names between kebab-case and camel-case if we decide this is too awkward.</p>
<p>Changes have been committed on 1.0 and 2.0 branches; and some JS unit tests updated (since now we need to be strict about using kebab-case for getting style properties. Previously when using the direct conversion of the CSSStyleDeclaration object, using camel-case to get a style property seemed to work, but actually only on some browsers).</p> SaxonJS - Bug #3704: Issues with ixsl:style()https://saxonica.plan.io/issues/3704?journal_id=112912018-03-05T14:40:30ZDebbie Lockettdebbie@saxonica.com
<ul><li><strong>Status</strong> changed from <i>In Progress</i> to <i>Resolved</i></li><li><strong>Fix Committed on JS Branch</strong> <i>Trunk</i> added</li></ul><p>Saxon-JS documentation updated to clarify use of camel-case for style property name in ixsl:set-style/@name, and kebab-case for keys in ixsl:style() map.</p> SaxonJS - Bug #3704: Issues with ixsl:style()https://saxonica.plan.io/issues/3704?journal_id=115472018-05-01T10:59:05ZDebbie Lockettdebbie@saxonica.com
<ul><li><strong>Applies to JS Branch</strong> <i>1.0</i> added</li><li><strong>Fix Committed on JS Branch</strong> <i>1.0</i> added</li></ul> SaxonJS - Bug #3704: Issues with ixsl:style()https://saxonica.plan.io/issues/3704?journal_id=115972018-05-09T10:21:12ZDebbie Lockettdebbie@saxonica.com
<ul><li><strong>Status</strong> changed from <i>Resolved</i> to <i>Closed</i></li><li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li><li><strong>Fixed in JS Release</strong> set to <i>Saxon-JS 1.1.0</i></li></ul><p>Bug fix applied in the Saxon-JS 1.1.0 maintenance release.</p>