简体   繁体   English

Internet Explorer:动态设置聚合物纸张工具提示innerHTML的问题

[英]Internet Explorer: issue with dynamically setting polymer paper-tooltip innerHTML

Using Polymer 1.0, paper-tooltip 使用Polymer 1.0,纸质工具提示

In the attached function I create a variable iconsToInsert , which contains svg and text elements which I put together as a string. 在附加的函数中,我创建了一个变量iconsToInsert ,其中包含svg和文本元素,它们作为字符串组合在一起。

When I have all the svg's and texts I need together, I set the innerHTML of the tooltip like this: 当我同时拥有所有需要的svg和文本时,我将工具提示的innerHTML设置如下:

tooltips[5].children[0].innerHTML = iconsToInsert;

This adds f.eg three svg's with text next to them in the tooltip. 这会在工具提示中添加例如三个svg,并在其旁边添加文字。

This works fine in Chrome and FF, but in Internet explorer I can only see the changed innerHTML in the dev tools but the tooltip is not triggered when hover over my element. 这在Chrome和FF中可以正常工作,但是在Internet Explorer中,我只能在开发工具中看到已更改的innerHTML,但将鼠标悬停在元素上时不会触发工具提示。

In Chrome and FF the tooltips class changes on hover from 'hidden style-scope paper-tooltip' to 'style-scope paper-tooltip' but here nothing happens. 在Chrome和FF中,工具提示类会从'hidden style-scope paper-tooltip'变为'style-scope paper-tooltip'但这里没有任何反应。

I have to do this, because I can't know from the beginning which icons and how much i have to insert. 我必须这样做,因为我从一开始就不知道要插入哪些图标以及要插入多少图标。

I know this is not so well explained and you probably need more details, just ask me please. 我知道这还不能很好地解释,您可能需要更多详细信息,请问我。

Well i solved it like this: 好吧,我这样解决了:

var lastVisibleIconTooltip = tooltips[5].children[0],
    myDiv = document.createElement('div');
myDiv.innerHTML = iconsToInsert;
lastVisibleIconTooltip.appendChild(myDiv)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM