0

Are there any known issues with custom elements created like so:

var body = document.body;
var spann = document.createElement("spann");
body.appendChild(spann);

in modern browsers, IE8+, Chrome 29+, FF 38+, Safari 8+

3
  • Did you mean span? Commented Apr 7, 2016 at 20:18
  • 1
    what do you mean by issues? it works fine in all those browsers, should behave just like a <span>... If you want to give it extra capabilities, use document.registerElement() before document.createElement() Commented Apr 7, 2016 at 20:18
  • 1
    also note that while your code will work, hard-coding a <spann>hello</spann> into HTML won't reflect CSS rules in IE8, eg. spann{color:red;}; it needs the document.createElement() Commented Apr 7, 2016 at 20:28

1 Answer 1

1

There shouldn't be any issues, what you have shown will work.

You are creating an HTML5 element if it is not one of the original set of elements. Keep in mind that your spann element with actually be styled like the default HTML5 element, which is essentially a span; no padding or margin, display inline.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.