Polymer: dom-repeat using select and option tags not working on IE11

Created on 3 Jun 2015  路  17Comments  路  Source: Polymer/polymer

This works on chrome, safari 8 and firefox, but no in ie11

To test it use this simple html file

<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Test</title>
    <script src="bower_components/webcomponentsjs/webcomponents-lite.js"></script>
    <link rel="import" href="bower_components/polymer/polymer.html">
    <style>
        html, body {
            width: 100%;
            height: 100%;
            margin: 0;
        }
    </style>
</head>

<body>

<template is="dom-bind" id="app">

    <select>
        <template is="dom-repeat" items="{{options}}" as="o">
            <option value="{{o}}">{{o}}</option>
        </template>
    </select>

</template>


<script>
    (function (document) {
        'use strict';

        var app = document.querySelector('#app');
        app.options = ['one', 'two'];

    })(document);
</script>

</body>
</html>
1.x dom-repeat ie11 p2

Most helpful comment

Is this still an issue in Polymer 2?

All 17 comments

The problem here is that IE's parser doesn't think <template> belongs in a <select>, so it helpfully removes it for you. <select> and <table> are among the "parser-challenged elements" referred to here:

https://www.polymer-project.org/1.0/docs/#binding-features

@robrez is correct that we had a workaround for this issue in 0.5. We don't have it yet for 1.0. One option is to use a custom element instead of the <select>.

Ok, thank you

is there a date when this issue will be fixed?
we are currently unable to migrate our polymer 0.5 app because it contains many tables and select elements with templates and it needs to work in IE/Edge

oh why people are still using IE :)?

@DominikMayrhofer

Selects are easy enough to work around:

var options = [ ... ];
var select = this.$.yourSelectElement;

options.forEach(function (item) {
    var option = document.createElement('option');
    option.textContent = item.Text;
    option.value = item.Value;
    select.appendChild(option);
});                                    

Tables are virtually the same, but possibly more arduous

it's been quite some time was this ever fixed?

@ssshake don't think so, I proposed a new feature in #3448 to address it

@ssshake no word, it got labelled 'enhancement/needs discussion' by a Polymer team member. Will have to wait and see. Re-rendering on item changes is definitely a pain point.

hey there, we've authored a polymer component that works around this select in IE issue pretty well (at least we think so). We'd really love some feedback. https://github.com/vehikl/polymer-select-with-options

@ssshake thanks for sharing the solution for select

This could be another way: https://github.com/Juicy/juicy-select

Is this still an issue in Polymer 2?

Still an issue with Polymer 2. Please fix.

Is this issue still not fixed ? Any suggestion ?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

oh why people are still using IE :)?

That's a very intelligent question. I also feel the same way, in fact why IE is still there.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

limonte picture limonte  路  3Comments

abdonrd picture abdonrd  路  4Comments

hzmnet picture hzmnet  路  4Comments

yairopro picture yairopro  路  3Comments

alexhx5 picture alexhx5  路  3Comments