question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Text nodes can't accept properties in IE8

See original GitHub issue

Hi guys!

First of all, thanks for you work, this library is awesome!

I know that IE8 is not officialy supported, but i have to and in your ‘Browser support’ page you say:

It should work fine in IE7 and IE8

I’ve fixed it locally with this patch:

let supportsAddTextNodeProps;

try {
  document.createTextNode('').test = true;
  supportsAddTextNodeProps = true;
} catch (e) {
  supportsAddTextNodeProps = false;
}

function getEmptyVNode() {
  if (!supportsAddTextNodeProps) {
    return document.createElement('p-empty');
  }

  return '';
}
// empty values (null & undefined) render as empty Text nodes
if (vnode==null) vnode = getEmptyVNode();

So, can we fix it? Or at least, can you remove "It should work fine in IE7 and IE8"?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
gdorsicommented, Feb 8, 2017

I’ve rapidly made the fix here

If it’s ok tomorrow i’ll do the PR.

Thanks for the support 😃

0reactions
developitcommented, Feb 8, 2019

Anyone looking for a workaround, here’s how to get Preact working (reasonably enough) in IE7 and IE8:

document.createTextNode = function(data) {
  var text = document.createElement('x-text')
  text.innerText = data
  return text
}

This fixes the text node properties issue. It causes text nodes to be recreated on every render, but that’s the price we pay 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Text nodes can't accept properties in IE8 · Issue #537 - GitHub
Hi guys! First of all, thanks for you work, this library is awesome! ... // empty values (null & undefined) render as empty...
Read more >
html - Inconsistent Whitespace Text Nodes in Internet Explorer
The solution is to skip text nodes in all browsers: var node = element.firstChild; while(node && node.nodeType == 3) node = node.nextSibling;. Popular ......
Read more >
The poor, misunderstood innerText - Perfection Kills
If the node is a Text node: 1. If the CSS "white-space" property of node's parent is "normal": Let collapsed_s be the value...
Read more >
Using aria-labelledby to concatenate a label from several text ...
So adding the aria-labelledby property to a native label should replace the text content inside that label unless the label itself is referenced...
Read more >
Process Model Object - Appian 20.4
Description: This line lists any descriptive text entered for the activity on the general tab of the node properties dialog box. Task Display...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found