protoc / zen-coding

Automatically exported from code.google.com/p/zen-coding
0 stars 0 forks source link

Labels+Inputs = <3 #251

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When we have the following abbreviation (or any similar): label>input# it'd be 
cool to have it expanded not to <label for="$1"><input type="$2" id="$3" 
/>$4</label>, but to <label for="$1"><input type="$2" id="$1" />$3</label> (in 
TM snippet notation)

The important part is the automatic mirroring of "for" and "id" attributes.

Original issue reported on code.google.com by kizmarh on 13 Mar 2011 at 9:05

GoogleCodeExporter commented 9 years ago
I have no idea how to implement this correctly: ZC works on abstract elements, 
it’s possible to combine label and input with intermediate elements, it’s 
possible to write many labels and inputs in one abbreviation etc. I think 
it’s better to define a new snippet for such cases

Original comment by serge....@gmail.com on 13 Mar 2011 at 9:58

GoogleCodeExporter commented 9 years ago
I made a custom snippet for this type of thing. Feel free to use and modify to 
your own preference, then add to your own snippets. This one is for labels with 
a text input.

'lblt': '<label for="${id}">${id}</label>\n<input type="text" name="${id}" 
id="${id}" />',

Original comment by angelw...@gmail.com on 14 Mar 2011 at 3:00

GoogleCodeExporter commented 9 years ago
Custom snippets are ok, but it'd be great if, for zen-coding, multipliation and 
counters worked for this. You can't achieve this with just a snippet.

However, if it's not trivial to implement this, well, ok.

Original comment by kizmarh on 14 Mar 2011 at 5:04

GoogleCodeExporter commented 9 years ago
Guys, what the heck?

Why not just make label>input expand into:
<label><input name=''></label> ??

Per the HTML spec, <input> tags without for attributes are implicitly 
associated with their contents (See: 
http://www.w3.org/TR/html401/interact/forms.html#h-17.9.1)

I just LOVE zen-coding, and the only thing that stop my flow is deleting these 
unnecessary 'for' attributes...

Much obliged!

Original comment by baronl...@gmail.com on 9 Jan 2012 at 10:52

GoogleCodeExporter commented 9 years ago
baronlior, you can always create your own snippets and abbreviations

Original comment by serge....@gmail.com on 9 Jan 2012 at 1:49

GoogleCodeExporter commented 9 years ago
Closing this issue for now because implementation is too ambiguous.

Original comment by serge....@gmail.com on 25 Jun 2012 at 8:30