I was kinda bored

Rolf Eike Beer kde at opensource.sf-tec.de
Thu Oct 7 19:53:15 BST 2010

Maksim Orlovich wrote:
> On 10/6/10, Rolf Eike Beer <kde at opensource.sf-tec.de> wrote:
> > I was hacking for something like 3 or 4 hours and came up with this
> > implementation of the "new" HTML5 <input type="number"> field. I have no
> > idea
> > if that is the right way to do it, I must also confess that most of the
> > code is copy&paste from the normal input fields. The only real testing I
> > did was using
> > http://diveintohtml5.org/examples/input-type-number-min-max-step.html
> > which seems to work as expected.
> > 
> > If someone with any insight in KHTML could take a look if this is
> > anything close to a sane implementation I would be happy to see
> > something like this going into KHTML for KDE 4.6. If it covers only half
> > of the cases it still makes the users life easier than the pure text
> > field ;)

> Thanks. Looks cool, and the diff looks pretty good (though I can't
> check the visual stuff in my head)... A couple things I noticed from
> reading it, though:
> 1) Don't change misc/htmlnames.{h/cpp} directly. Rather edit
> misc/htmlattrs.in and re-run
> misc/gennames.py. Then "enjoy" a full recompile...

Whatever works ;) This should definitely go into khtml/doc/ something then.

> 2)
> +        if ((int)m_numberMin == m_numberMin)
> +            ok = ((int)tmp == tmp);
> Probably need to check the original ok here, too.
> It's probably also worth checking whether something like
> setAttribute("min", "monkeys!") is supposed to reset the value to default
> or not.

That's probably somehow related to JavaScript and stuff, no? There are some JS 
accessor functions (input.stepUp(n), input.stepDown(n) and 
input.valueAsNumber() that are missing). I have no idea about JavaScript at 
all, even less about how to implement this in KHTML.

> 3) RenderNumberEdit::upateFromElement:() needs to update min/max/step as
> well

Yeah, probably. Also W3C says an empty string as input must be allowed. And of 
course there are no unit-tests.

> Also, it'd probably be better to e-mail kfm-devel with stuff like
> this, especially if you use a vague title ;-).

Yeah, you are right. Full quote and CC, once again the attachment (sorry kde-

-------------- next part --------------
A non-text attachment was scrubbed...
Name: html5-number.patch
Type: text/x-patch
Size: 11568 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20101007/1f851e00/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20101007/1f851e00/attachment.sig>

More information about the kde-core-devel mailing list