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).

  • 8
    \$\begingroup\$ You could also state your reasons as to why this question should be reopened. Otherwise, it looks more demanding. \$\endgroup\$
    – Jamal
    Jul 27, 2016 at 4:13
  • 2
    \$\begingroup\$ Aside from that... you already have an answer. You can definitely edit the answer. (Not that I'd recommend) \$\endgroup\$
    – Vogel612
    Jul 27, 2016 at 6:52
  • \$\begingroup\$ @Vogel612 so... you wouldn't recommend the course of action that you recommend? I propose simply reopening it for answers, at which point each individual contributor can decide whether to post an answer or not, independently. Basically, can you explain to me why you're apparently refusing to allow anyone else to post on this question, yet not just outright deleting it? \$\endgroup\$ Jul 27, 2016 at 7:14
  • 4
    \$\begingroup\$ @Quuxplusone I'm not "refusing to allow" anything here on site. I'm not a moderator. I'm saying that you personally could edit your answer if you wanted to. The questions is put [on hold] as "unclear what you're asking" for reasons outlined by syb0rg in comments on the question. I personally agree with the reasoning given there. That very same comment explaining the reasons also gives a course of action that would result in the question being reopened... The point of putting questions [on hold] is not preventing answers, but to solicit improvement so that answers can actually make sense \$\endgroup\$
    – Vogel612
    Jul 27, 2016 at 7:23

1 Answer 1


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.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .