Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

minor additions to document #172

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ var Webapi__Dom__NodeFilter = require("../../../src/Webapi/Webapi__Dom/Webapi__D

var el = document.createElement("strong");

document.characterSet;

Webapi__Dom__Document.compatMode(document);

document.doctype;
Expand Down
1 change: 0 additions & 1 deletion src/Webapi/Webapi__Dom/Webapi__Dom__Document.re
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ module Impl = (T: {type t;}) => {
let ofNode = (node: Dom.node) : option(T.t) =>
Webapi__Dom__Node.nodeType(node) == Document ? Some(Obj.magic(node)) : None;

[@bs.get] external characterSet : T.t => string = "";
[@bs.get] external compatMode : T.t => string /* compatMode enum */ = ""; /* experimental */
let compatMode: T.t => Webapi__Dom__Types.compatMode =
(self) => Webapi__Dom__Types.decodeCompatMode(compatMode(self));
Expand Down
2 changes: 2 additions & 0 deletions src/Webapi/Webapi__Dom/Webapi__Dom__HtmlDocument.re
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ module Impl = (T: {type t;}) => {

[@bs.get] [@bs.return nullable] external activeElement : t_htmlDocument => option(Dom.element) = "";
[@bs.get] [@bs.return nullable] external body : t_htmlDocument => option(Dom.element) = ""; /* returns option HTMLBodyElement */
[@bs.get] external characterSet : t_htmlDocument => string = "";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why has this been moved here from Document? The documentation you refer to lists it as a property of Document, and as HtmlDocument inherits everything from Document it should be available here anyway.

Copy link
Author

@BlueHotDog BlueHotDog Apr 12, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weird, didnt find it. but will remove it from here.
In general i wonder what's the actal distinction between document and htmldocument.
In the docs it means that for all porpuses its the same thing when dealing with the web.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have also removed it from Document, and from its test, so it is actually moved, not added. Seems like it took you a few iterations to get here though, so I guess a mixup happened somewhere.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HTMLDOcument is a subtype of Document, ie. more specific. In addition to HTML Documents a Document can also be an XMLDocument and I think also an SVGDocument. These kinds of documents also exist on the web.

[@bs.set] external setBody : (t_htmlDocument, Dom.element) => unit = "body"; /* accepth HTMLBodyElement */
[@bs.get] external cookie : t_htmlDocument => string = "";
[@bs.set] external setCookie : (t_htmlDocument, string) => unit = "cookie";
[@bs.get] [@bs.return nullable] external defaultView : t_htmlDocument => option(Dom.window) = "";
[@bs.get] external designMode : t_htmlDocument => string /* designMode enum */ = "";
[@bs.get] external contentType: T.t => string = "";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is marked as experimental on MDN and seems to be unavailable on IE11 and Opera Mini. I'm hesitant to include APIs that aren't fully standardized, although this seems pretty established. It should at least have a comment noting that it's experimental here as well. It should also be in Document, not HtmlDocument.

let designMode: t_htmlDocument => Webapi__Dom__Types.designMode =
(self) => Webapi__Dom__Types.decodeDesignMode(designMode(self));
[@bs.set] external setDesignMode : (t_htmlDocument, string /* designMode enum */) => unit = "designMode";
Expand Down
1 change: 0 additions & 1 deletion tests/Webapi/Webapi__Dom/Webapi__Dom__Document__test.re
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ open Document;

let el = document |> createElement("strong");

let _ = characterSet(document);
let _ = compatMode(document);
let _ = doctype(document);
let _ = documentElement(document);
Expand Down