Re: attributes without values

Ashish Agarwal <[email protected]> Mon, 5 May 2014 09:25:27 -0400
Newsgroups gmane.comp.lang.ocaml.lib.net.devel
Message-ID <CAMu2m2J5JYdtztNb2Surv0D1GE3XmPGmyX-7ZDjgc017tLj4DQ@mail.gmail.com>
--===============2209128880366604664==
Content-Type: multipart/alternative; boundary=001a11c32276c0d4c704f8a71102

--001a11c32276c0d4c704f8a71102
Content-Type: text/plain; charset=UTF-8

The HTML5 reference [1] states that attribute values can be omitted, and
that this is equivalent to giving the empty string as the value. I can't
seem to find the rules in the HTML4 spec [2]. Does Nethtml allow specifying
which version of HTML is being parsed/printed? If the spec has changed, I'm
not sure how you want to handle the conflict.

[1] http://www.w3.org/TR/html5/syntax.html#attributes-0
[2] http://www.w3.org/TR/html401/



On Sun, May 4, 2014 at 4:40 PM, Gerd Stolpmann <[email protected]>wrote:

> The parser does so because the HTML-4 standard (don't know whether
> HTML-5 changed this) explicitly specifies that a value-less attribute
> must be handled like this.
>
> Maybe that should be configurable. The spec could go into the dtd, and
> it would just include all standard cases, so that attributes outside the
> standard are not affected.
>
> Gerd
>
> Am Freitag, den 02.05.2014, 17:06 -0400 schrieb Ashish Agarwal:
> > Html like "<div data-id></div>" gets parsed as:
> >
> > Nethtml.Element ("div", [("data-id", "data-id")], [])
> >
> >
> > The value is set to the attribute name, which seems wrong. The correct
> > solution would be to change the type of an element so that values are
> > `string option`, but I'm guessing that's infeasible. Alternatively,
> > the parser should set the value to the empty string.
> >
> >
> >
> ------------------------------------------------------------------------------
> > "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
> > Instantly run your Selenium tests across 300+ browser/OS combos.  Get
> > unparalleled scalability from the best Selenium testing platform
> available.
> > Simple to use. Nothing to install. Get started now for free."
> > http://p.sf.net/sfu/SauceLabs
> > _______________________________________________
> > Ocamlnet-devel mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/ocamlnet-devel
>
> --
> ------------------------------------------------------------
> Gerd Stolpmann, Darmstadt, Germany    [email protected]
> My OCaml site:          http://www.camlcity.org
> Contact details:        http://www.camlcity.org/contact.html
> Company homepage:       http://www.gerd-stolpmann.de
> ------------------------------------------------------------
>
>
>

--001a11c32276c0d4c704f8a71102
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">The HTML5 reference [1] states that attribute values can b=
e omitted, and that this is equivalent to giving the empty string as the va=
lue. I can&#39;t seem to find the rules in the HTML4 spec [2]. Does Nethtml=
 allow specifying which version of HTML is being parsed/printed? If the spe=
c has changed, I&#39;m not sure how you want to handle the conflict.<div>

<br></div><div><div>[1]=C2=A0<a href=3D"http://www.w3.org/TR/html5/syntax.h=
tml#attributes-0">http://www.w3.org/TR/html5/syntax.html#attributes-0</a></=
div><div>[2]=C2=A0<a href=3D"http://www.w3.org/TR/html401/">http://www.w3.o=
rg/TR/html401/</a></div>

<div><br></div></div></div><div class=3D"gmail_extra"><br><br><div class=3D=
"gmail_quote">On Sun, May 4, 2014 at 4:40 PM, Gerd Stolpmann <span dir=3D"l=
tr">&lt;<a href=3D"mailto:[email protected]" target=3D"_blank">info@ge=
rd-stolpmann.de</a>&gt;</span> wrote:<br>

<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">The parser does so because the HTML-4 standa=
rd (don&#39;t know whether<br>
HTML-5 changed this) explicitly specifies that a value-less attribute<br>
must be handled like this.<br>
<br>
Maybe that should be configurable. The spec could go into the dtd, and<br>
it would just include all standard cases, so that attributes outside the<br=
>
standard are not affected.<br>
<br>
Gerd<br>
<br>
Am Freitag, den 02.05.2014, 17:06 -0400 schrieb Ashish Agarwal:<br>
<div><div class=3D"h5">&gt; Html like &quot;&lt;div data-id&gt;&lt;/div&gt;=
&quot; gets parsed as:<br>
&gt;<br>
&gt; Nethtml.Element (&quot;div&quot;, [(&quot;data-id&quot;, &quot;data-id=
&quot;)], [])<br>
&gt;<br>
&gt;<br>
&gt; The value is set to the attribute name, which seems wrong. The correct=
<br>
&gt; solution would be to change the type of an element so that values are<=
br>
&gt; `string option`, but I&#39;m guessing that&#39;s infeasible. Alternati=
vely,<br>
&gt; the parser should set the value to the empty string.<br>
&gt;<br>
&gt;<br>
</div></div>&gt; ----------------------------------------------------------=
--------------------<br>
&gt; &quot;Accelerate Dev Cycles with Automated Cross-Browser Testing - For=
 FREE<br>
&gt; Instantly run your Selenium tests across 300+ browser/OS combos. =C2=
=A0Get<br>
&gt; unparalleled scalability from the best Selenium testing platform avail=
able.<br>
&gt; Simple to use. Nothing to install. Get started now for free.&quot;<br>
&gt; <a href=3D"http://p.sf.net/sfu/SauceLabs" target=3D"_blank">http://p.s=
f.net/sfu/SauceLabs</a><br>
&gt; _______________________________________________<br>
&gt; Ocamlnet-devel mailing list<br>
&gt; <a href=3D"mailto:[email protected]">Ocamlnet-devel=
@lists.sourceforge.net</a><br>
&gt; <a href=3D"https://lists.sourceforge.net/lists/listinfo/ocamlnet-devel=
" target=3D"_blank">https://lists.sourceforge.net/lists/listinfo/ocamlnet-d=
evel</a><br>
<span class=3D"HOEnZb"><font color=3D"#888888"><br>
--<br>
------------------------------------------------------------<br>
Gerd Stolpmann, Darmstadt, Germany =C2=A0 =C2=A0<a href=3D"mailto:gerd@gerd=
-stolpmann.de">[email protected]</a><br>
My OCaml site: =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0<a href=3D"http://www.caml=
city.org" target=3D"_blank">http://www.camlcity.org</a><br>
Contact details: =C2=A0 =C2=A0 =C2=A0 =C2=A0<a href=3D"http://www.camlcity.=
org/contact.html" target=3D"_blank">http://www.camlcity.org/contact.html</a=
><br>
Company homepage: =C2=A0 =C2=A0 =C2=A0 <a href=3D"http://www.gerd-stolpmann=
.de" target=3D"_blank">http://www.gerd-stolpmann.de</a><br>
------------------------------------------------------------<br>
<br>
<br>
</font></span></blockquote></div><br></div>

--001a11c32276c0d4c704f8a71102--


--===============2209128880366604664==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
Is your legacy SCM system holding you back? Join Perforce May 7 to find out:
&#149; 3 signs your SCM is hindering your productivity
&#149; Requirements for releasing software faster
&#149; Expert tips and advice for migrating your SCM now
http://p.sf.net/sfu/perforce
--===============2209128880366604664==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Ocamlnet-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ocamlnet-devel

--===============2209128880366604664==--