Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding attribute to <html> tag #14

Closed
TueeNguyen opened this issue Oct 2, 2021 · 1 comment · Fixed by #16
Closed

Adding attribute to <html> tag #14

TueeNguyen opened this issue Oct 2, 2021 · 1 comment · Fixed by #16
Assignees

Comments

@TueeNguyen
Copy link

Hi, I was trying to add a lang attribute to html , however, there is no method in class Document that allow me to get <html> element or adding attribute to it.

I ended up getting the HTML string using getHTML() and edit using regEx.

Is it possible to add some code to getHTML() to make it easier?

For example:

getHTML(lang) {
		if(lang)
			return `<!DOCTYPE html><html lang=${lang}>${this.getContentInHTML()}</html>`;
		return `<!DOCTYPE html><html>${this.getContentInHTML()}</html>`;
	}
@Hargne Hargne self-assigned this Oct 3, 2021
@Hargne
Copy link
Owner

Hargne commented Oct 3, 2021

Hi,
Sounds like a neat idea. I will see if I can add functionality to modify the html-tag. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants