Using templates and function overloads to set DOM attributes
This question was quickly marked "on hold", which means new answers cannot be posted (not even by me, who's already posted one incomplete answer).
Using templates and function overloads to set DOM attributes
This question was quickly marked "on hold", which means new answers cannot be posted (not even by me, who's already posted one incomplete answer).
I, and from what I'm reading, others too, are having significant problems understanding just exactly what the asker wants his code to do. He describes that people normally build webpages via string concatenation, which I can understand to be a problem. So he goes for a node based approach instead, sort of like building an XML tree.
... But then there's templates for building these nodes that actually only print the input to stdout, and ... it doesn't seem to actually do anything? It doesn't store data, it just throws things to stdout. The asker wants to restrict the attributes that you can set, has done so in this example, and is now wondering, "hey, this is really crappy, I'm gonna have to make 173 different functions for this. Maybe there's a better way?"
Except that I don't even know where he wants to go with this. I had to spend significant effort to reach this level of understanding, and I still don't know enough to answer.
But, you answered yourself. Lets see if I can learn something from that.
... From what I'm reading from your answer, though, half of it is confusion. You have succesfully pointed out one flaw... which is the flaw OP has pointed out themselves: That's gonna be a lot of typing.
Actually, seems like the OP added that after receiving your answer. And at this point he's basically looking to get his design idea reviewed. Here's the 3 cases I made so far, kind of, how would I go about making the rest?
As it stands, the question is too hard to grasp effectively even by people with domain knowledge. I personally think it would be better if the question was improved, to get better answers for the question. Until then, block answering as an incentive and to avoid wasting time.