bjuppa / fluent-html Goto Github PK
View Code? Open in Web Editor NEWFluent HTML builder for PHP
Fluent HTML builder for PHP
What if we could add withoutCloseTag($keep_open=true)
that makes a FluentHtmlElement
not render it's closing tag in branchToHtml()
?
(it would also require an additional parameter to HtmlBuilder::buildHtmlElement()
that keeps the tag open)
Then we could open up elements to allow a static open()
call that works the same as create()
(or the constructor) but keeping the tag open.
I guess we'd need to keep a (private static) stack of open elements in FluentHtmlElement
and set the last non-closed element as parent to an empty (no element name) holder element and set that holder as parent on any new instances created when a tag is open.
(The holder would be needed to keep the possibility of adding content before and after the current element.)
(Can an abstract class have static variables? If not, that won't work... But I think they can, referenced in a method on the abstract class using self::$static_var
- not static::$static_var
)
Then there should be a static close()
method that pops the last open element from the stack, and returns a close tag string.
This would of course not work in any situation where a child element is trying to change or add content to a non-closed parent element that has already been rendered. The change would be done, but not visible. But that situation should be pretty rare.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.