[Prototype-core] proposal: function to validate HTML

10 views
Skip to first unread message

walther diechmann

unread,
May 6, 2010, 7:33:38 AM5/6/10
to Prototype: Core
on the rebound from a 'tour de force' of W3C specs pertaining to the
DOCTYPE and it's cripling effects on IE's (not) handling improperly
written input tags I was wondering:

Given I have a HTML string
When I call Object.validate( html_string [, doc_type])
Then I can see whether the HTML string is valid

{ errors_count: 2, warnings_count: 1, errors: { 1: { line: 5, short:
'short description', help: URL }, 2: {}}, warnings: { 1: { } } } =
Object.validate( string [, string] )

with URL being a link to the non conformancy related W3C document/
chapter/paragraph

Just a thought :)

BTW: You could - using the validate method - build validation into
methods like Element#replace and #update, when supplying an option or
argument...

Cheers,
Walther

ps. I'm in way pointing my fingers at IE which (in this case) turns
out to be the exemplary scholar in class, sticking to the standards
entirely!

--
You received this message because you are subscribed to the Google Groups "Prototype: Core" group.
To post to this group, send email to prototy...@googlegroups.com
To unsubscribe from this group, send email to prototype-cor...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en

T.J. Crowder

unread,
May 8, 2010, 2:07:38 AM5/8/10
to Prototype: Core
Hi,

Validating HTML against a DOCTYPE is a non-trivial task, and it should
be (IMHO) an authoring-time task (using tools like the W3C
Validator[1]) rather than a runtime task, where Prototype is mostly
focussed on the latter. So I don't see adding this to Prototype. (This
is just my opinion; I'm not a core dev, I don't make decisions for the
project).

If you're receiving HTML from an external source at runtime, I can see
the desire to validate it. For that kind of thing, you may want to
integrate with one of the validation services out there (there's a
short list here[2]) and/or look into mod_validator[3] for Apache.

[1] http://validator.w3.org/
[2] http://validator.w3.org/docs/help.html#others
[3] http://apache.webthing.com/mod_validator/

HTH,
--
T.J. Crowder
Independent Software Consultant
tj / crowder software / com
www.crowdersoftware.com

On May 6, 12:33 pm, walther diechmann <waltherdiechm...@gmail.com>
wrote:

Allen Madsen

unread,
May 8, 2010, 8:01:45 AM5/8/10
to prototy...@googlegroups.com
I agree with T.J.

Allen Madsen
http://www.allenmadsen.com

Tobie Langel

unread,
May 8, 2010, 7:17:05 PM5/8/10
to Prototype: Core
Thanks for your suggestion.

This would be quite an undertaking… and falls completely out of the
scope of Prototype, so it's certainly something that won't make it's
way into Prototype Core.

Sorry for the bad news!

Best,

Tobie
Reply all
Reply to author
Forward
0 new messages