From: Ashish A. <aga...@gm...> - 2014-05-02 21:06:29
|
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. |
From: Gerd S. <in...@ge...> - 2014-05-04 20:40:23
|
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 > Oca...@li... > https://lists.sourceforge.net/lists/listinfo/ocamlnet-devel -- ------------------------------------------------------------ Gerd Stolpmann, Darmstadt, Germany ge...@ge... My OCaml site: http://www.camlcity.org Contact details: http://www.camlcity.org/contact.html Company homepage: http://www.gerd-stolpmann.de ------------------------------------------------------------ |
From: Ashish A. <aga...@gm...> - 2014-05-05 13:25:54
|
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 <in...@ge...>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 > > Oca...@li... > > https://lists.sourceforge.net/lists/listinfo/ocamlnet-devel > > -- > ------------------------------------------------------------ > Gerd Stolpmann, Darmstadt, Germany ge...@ge... > My OCaml site: http://www.camlcity.org > Contact details: http://www.camlcity.org/contact.html > Company homepage: http://www.gerd-stolpmann.de > ------------------------------------------------------------ > > > |
From: Ashish A. <aga...@gm...> - 2014-05-05 22:44:32
|
On Mon, May 5, 2014 at 3:01 PM, Christophe Troestler < Chr...@um...> wrote: In practice, I have found that it generally does not matter because > this type of shortcut is only used when the presence of the attribute > counts but not its value. @Ashish What about data- attributes? As far as I can tell there is nothing special about data-* attributes that would affect parsing and printing. They are just like any other attribute. Their only purpose is they indicate an attribute that should be "private to the page", meaning external consumers of the page should ignore them. |