What is content? If it starts with a space, then the TextNode will be the first child and they don't have style properties (HTMLElementNodes do).
You can:
- loop over children until you reach the end or find an HTMLElementNode
- separate the spaces from the beginning
content - switch to use
createElementand friends insteadinnerHTML
source
share