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 16524 - ask about reasons to use getter/setter for lineDash
Summary: ask about reasons to use getter/setter for lineDash
Status: RESOLVED FIXED
Alias: None
Product: HTML WG
Classification: Unclassified
Component: HTML Canvas 2D Context (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: ---
Assignee: Ian 'Hixie' Hickson
QA Contact: HTML WG Bugzilla archive list
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-26 14:29 UTC by contributor
Modified: 2012-03-29 03:17 UTC (History)
6 users (show)

See Also:


Attachments

Description contributor 2012-03-26 14:29:36 UTC
Specification: http://dev.w3.org/html5/2dcontext/
Multipage: http://www.whatwg.org/C#top
Complete: http://www.whatwg.org/c#top

Comment:
Hi Ian,

I've some comments about the recent added line dashes. Right now, the mozilla
and webkit implements this as an attribute, but in this version, it uses
setLineDash() and getLineDash(). These setter/getter are not consistent with
the other line styles, such as lineWidth. (There's no such functions called
setLineWidth() and getLineWidth()). What's the reason behind this API design?

Thanks!
guanqun.lu@intel.com

Posted from: 134.134.139.76
User agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20100101 Firefox/11.0
Comment 1 Ian 'Hixie' Hickson 2012-03-27 06:36:10 UTC
There's not really a good way to make array-based attributes work. I'll post a more detailed comment in response to the WHATWG e-mail Mozilla sent suggesting the methods (they intend to remove the attributes).
Comment 2 Ian 'Hixie' Hickson 2012-03-28 21:57:21 UTC
Basically, the reason is that there's no way to make it work with an attribute:

context.lineDash = [1,2,3];
context.lineDash[0] = 2; // what should happen?

var a = [1,2,3];
context.lineDash = a;
a[0] = 2; // what should happen to context.lineDash?

If you look at the feedback Mozilla sent the WHATWG list you'll see they had the same concern with their implementation.


(I'm marking the bug resolved since this was just a question, not feedback. Feel free to e-mail the WHATWG list or me directly or indeed to chat on the #whatwg IRC channel on Freenode if you have any questions.)
Comment 3 Lu Guanqun 2012-03-29 03:17:47 UTC
Thanks for your explanation, Ian.