dennwc / dom

DOM library for Go and WASM
Apache License 2.0
490 stars 59 forks source link

Adds document title element #47

Open smoyer64 opened 5 years ago

smoyer64 commented 5 years ago

Resolves #46

dennwc commented 5 years ago

Sorry, I don't think this should be added. This change unconditionally creates a title element in the DOM, which might or might not be desired.

smoyer64 commented 5 years ago

Ah ... that it does (and leaves it empty). The one in my library is Title() so it only creates the element if you ask for it. I was also looking into the failing unit test - the underlying code compiles and then works in the browser.

Would you be open to Title() and SetTitle() functions for this? ... the <title> element (and others) are "special": https://developer.mozilla.org/en-US/docs/Web/HTML/Element/title. I suppose another alternative is to export getFirstWithTag which is about 70% of the code I discovered was duplicated in my library.