extensibleweb / webidl.js

An implementation of WebIDL in ECMAScript
55 stars 14 forks source link

implement DOMString type #15

Closed marcoscaceres closed 11 years ago

marcoscaceres commented 11 years ago

http://www.w3.org/TR/WebIDL/#idl-DOMString

marcoscaceres commented 11 years ago

Implemented but untested. Waiting in pull request queue.

marcoscaceres commented 11 years ago

@FremyCompany, I wonder if we want to support the "convert a DOMString to a sequence of Unicode characters" algorithm as part of the conversion? Not sure if i should add it or not.

http://dev.w3.org/2006/webapi/WebIDL/#idl-DOMString

FremyCompany commented 11 years ago

I don't think. We should just leave to //NOTE in the code to make sure we document our choice to leave this away for now.

marcoscaceres commented 11 years ago

WFM. Thanks. Will start testing DOMString these now.

marcoscaceres commented 11 years ago

I'm confused as to calling WebIDL.DOMString() results in an ES6 "abrupt completion". That is, does:

WebIDL.DOMString() === "";
//or 
WebIDL.DOMString() === "undefined";

Calling String constructor results in an empty string: String() === ''

FremyCompany commented 11 years ago

Good question. I think it's up to us to define that.

marcoscaceres commented 11 years ago

yeah, I see what you mean. There might be some strange cases like:

void doSomething(DOMString baz, optional DOMString foo);

In the above case foo would not matter as it would need to be handled by the author as missing. In cases where it is not optional (baz), missing would cause an exception - so that solves that :)

marcoscaceres commented 11 years ago

Implementation complete and ready for review: https://github.com/extensibleweb/webidl.js/blob/master/lib/types/DOMString.js

FremyCompany commented 11 years ago

reviewed, ok

marcoscaceres commented 11 years ago

Thanks @FremyCompany!

marcoscaceres commented 11 years ago

Reopening as it's lacking documentation.