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

How to create HTML tags? #178

Open
salarmehr opened this issue Mar 19, 2016 · 2 comments
Open

How to create HTML tags? #178

salarmehr opened this issue Mar 19, 2016 · 2 comments

Comments

@salarmehr
Copy link

Running

echo qp('<div>s</div>')->html();

similar to other jQuery PHP implementation, I expect to get <div>s</div> but it returns a complete document:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><body><div>s</div></body></html>

and I have to use qp('<div>s</div>')->top('body *')->html(); which is cumbersome. In particular when use what to build several section of a page programmatically and merge them

@salarmehr salarmehr changed the title Could not crate partial dom How to create HTML tags? Mar 19, 2016
@technosophos
Copy link
Owner

Does innerHtml() work?

You may also consider switching the parser to the HTML5 one. It's less picky than the built-in libxml html 4 parser. I can't remember if it will make a difference, but you can try html5() instead of html and see if that helps.

@salarmehr
Copy link
Author

echo qp('<div></div>')->innerHtml(); reutrns <body> <div/></body>

It seems there is no difference between the output of html5() and html()

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

No branches or pull requests

2 participants