<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>218339</bug_id>
          
          <creation_ts>2020-10-29 07:47:36 -0700</creation_ts>
          <short_desc>HTML template element does not respect input type=&quot;color&quot;</short_desc>
          <delta_ts>2020-10-30 00:42:18 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>DOM</component>
          <version>Safari 14</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>macOS 10.15</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>216985</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Daniel Dietrich">cafebab3</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>akeerthi</cc>
    
    <cc>rniwa</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1702722</commentid>
    <comment_count>0</comment_count>
      <attachid>412647</attachid>
    <who name="Daniel Dietrich">cafebab3</who>
    <bug_when>2020-10-29 07:47:36 -0700</bug_when>
    <thetext>Created attachment 412647
Minimal sample html page to reproduce the bug.

### Overview

The HTML Content Template element `&lt;template&gt;` does not respect the HTML5 input type=&quot;color&quot;.
Instead of rendering a color picker, an ordinary input field is shown.

### Steps to Reproduce

Open the attached html file in a Safari browser.

### Actual Results

An input text field is rendered.

### Expected Results

A color picker should be rendered.

### Additional Builds and Platforms

Doesn&apos;t occur on current version of Chrome and Firefox.

### Additional Information

Above, we reproduced the bug using a template tag as part of the markup of a html document.

The bug also occurs, when create a template element dynamically using javascript:

    const template = document.createElement(&apos;template&apos;)
    template.innerHTML = &apos;&lt;input type=&quot;color&quot;&gt;&apos;
    const fragment = template.content
    document.body.appendChild(fragment.cloneNode(true))

The bug does not occur when rendering to a div.
The following code can be used as a **workaround** for the bug:

    const div = document.createElement(&apos;div&apos;)
    div.innerHTML = &apos;&lt;input type=&quot;color&quot;&gt;&apos;
    const fragment = document.createDocumentFragment()
    fragment.append(...div.childNodes)
    document.body.appendChild(fragment.cloneNode(true))

Here you can find a benchmark that compares the workaround with the canonical solution:

    https://esbench.com/bench/5f9ac111b4632100a7dcd4e0

Thanks!

Daniel</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1702925</commentid>
    <comment_count>1</comment_count>
    <who name="Aditya Keerthi">akeerthi</who>
    <bug_when>2020-10-29 17:27:13 -0700</bug_when>
    <thetext>This is a duplicate of https://bugs.webkit.org/show_bug.cgi?id=216985.

It&apos;s fixed in Safari Technology Preview 116.

*** This bug has been marked as a duplicate of bug 216985 ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1702992</commentid>
    <comment_count>2</comment_count>
    <who name="Daniel Dietrich">cafebab3</who>
    <bug_when>2020-10-30 00:42:18 -0700</bug_when>
    <thetext>Awesome, thanks for the fast reply!</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>412647</attachid>
            <date>2020-10-29 07:47:36 -0700</date>
            <delta_ts>2020-10-29 07:47:36 -0700</delta_ts>
            <desc>Minimal sample html page to reproduce the bug.</desc>
            <filename>safari-template-bug.html</filename>
            <type>text/html</type>
            <size>510</size>
            <attacher name="Daniel Dietrich">cafebab3</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWw+CjxodG1sPgogICA8aGVhZD4KICAgICAgPHRpdGxlPkhUTUwgdGVtcGxh
dGUgYnVnPC90aXRsZT4KICAgPC9oZWFkPgogICA8Ym9keT4KICAgICAgPHRlbXBsYXRlIGlkPSJ0
ZW1wbGF0ZSI+CiAgICAgICAgIDxpbnB1dCB0eXBlPSJjb2xvciI+CiAgICAgIDwvdGVtcGxhdGU+
CiAgICAgIDxkaXYgaWQ9ImFwcCI+CiAgICAgIDwvZGl2PgogICAgICA8c2NyaXB0PgogICAgICAg
ICB3aW5kb3cub25sb2FkID0gKCkgPT4gewogICAgICAgICAgICBjb25zdCB0ZW1wbGF0ZSA9IGRv
Y3VtZW50LmdldEVsZW1lbnRCeUlkKCd0ZW1wbGF0ZScpCiAgICAgICAgICAgIGNvbnN0IGFwcCA9
IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCdhcHAnKQogICAgICAgICAgICBhcHAuYXBwZW5kQ2hp
bGQodGVtcGxhdGUuY29udGVudCkgLy8gc2ltcGxpZmllZCwgd2l0aG91dCB1c2luZyBjbG9uZU5v
ZGUodHJ1ZSkKICAgICAgICAgfQogICAgICA8L3NjcmlwdD4KICAgPC9ib2R5Pgo8L2h0bWw+
</data>

          </attachment>
      

    </bug>

</bugzilla>