-
-
Notifications
You must be signed in to change notification settings - Fork 149
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
HTML: addChild() & addChildren() #223
Comments
When passing Html object as an parameter there is no space for XSS. If you do not trust input, you can use |
@jkuchar My point is that if you pass a variable into |
I still do not see a point. I you are calling |
@jkuchar The point is that you want to use API which helps you to avoid working with unsafe content as much as possible. So if there is As I do not want to make BCs, I do not propose to change the parameter type but create new method with strictly typed parameter. But that is only part of the proposal. The second one is about nesting more children at once – |
▸ Is your feature request related to a problem? Please describe.
There is no intuitive way to nest element and nest them safely. I can use one of following methods:
Html::el('ul')->addHtml(Html::el('li'))
addHtml()
's parameter acceptsstring
as well which opens it for potential XSS issuesHtml::el('ul')->create('li')
▸ Explain your intentions.
I suggest to create
addChild(Html $child)
andaddChildren(Html[] $children)
methods onHtml
objects. As it accepts onlyHtml
instances it is safe and its name also goes with industry standard.▸ It's up to you to make a strong case to convince the project's developers of the merits of this feature.
I did above.
I can make a pull request if you agree on this proposal as well.
The text was updated successfully, but these errors were encountered: