Merge "Add prependLabel() method in ActionContext"

This commit is contained in:
Shawn Pearce
2013-08-20 00:24:39 +00:00
committed by Gerrit Code Review
2 changed files with 10 additions and 0 deletions

View File

@@ -385,6 +385,10 @@ functions to make working with DOM based widgets less painful.
and the string `label`. Used to wrap a checkbox with its label,
`label(checkbox(), 'Click Me')`.
* `prependLabel(label, c)`: a new `<label>` element wrapping element `c`
and the string `label`. Used to wrap an input field with its label,
`prependLabel('Greeting message', textfield())`.
* `textarea(options)`: new `<textarea>` element. The options
object may optionally include `rows` and `cols`. The textarea
comes with an onkeypress handler installed to play nicely with

View File

@@ -62,6 +62,12 @@ public class ActionContext extends JavaScriptObject {
e.appendChild(doc.createTextNode(label));
return e;
},
prependLabel: function(label,c) {
var e = doc.createElement('label');
e.appendChild(doc.createTextNode(label));
e.appendChild(c);
return e;
},
span: function() {
var e = doc.createElement('span');
for (var i = 0; i < arguments.length; i++)