This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 27492 - "DOMQuad" constructor should accept DOMQuadInit
Summary: "DOMQuad" constructor should accept DOMQuadInit
Status: RESOLVED FIXED
Alias: None
Product: FXTF
Classification: Unclassified
Component: Geometry (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Simon Pieters
QA Contact: sideshowbarker+geometry
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-12-03 10:20 UTC by Simon Pieters
Modified: 2015-04-17 12:51 UTC (History)
1 user (show)

See Also:


Attachments

Description Simon Pieters 2014-12-03 10:20:25 UTC
http://dev.w3.org/fxtf/geometry/#dom-domquad

[[
DOMQuad
]]

Why is there no DOMQuadInit that can be used for DOMQuad constructor?
Comment 1 Simon Pieters 2015-03-24 20:23:36 UTC
I guess we can't support both a DOMRectInit and a DOMQuadInit, as it wouldn't be possible to tell which one is used.

Possibly we can have a dictionary type with members for both rect and quad, and have the constructor throw if the object has members for both?

dictionary DOMRectOrQuadInit {
    unrestricted double x;
    unrestricted double y;
    unrestricted double width;
    unrestricted double height;
    DOMPointInit p1;
    DOMPointInit p2;
    DOMPointInit p3;
    DOMPointInit p4;
};

new DOMQuad({}); // all points are 0,0
new DOMQuad({width: 100, height: 100}); // rect
new DOMQuad({p2: {x: 100}, p3: {x: 100, y: 100}, p4: {y: 100}}); // quad
new DOMQuad({p1: {}, x: 100}); // throws TypeError
Comment 3 Simon Pieters 2015-04-17 12:18:22 UTC
Oops, sorry, this is not fixed yet.