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 11172 - wouldn't it be better to return the context handler instead of void, making "context.moveTo(x1,y1).lineTo(x2,y2).lineTo..." possible and easier?
Summary: wouldn't it be better to return the context handler instead of void, making "...
Status: RESOLVED WONTFIX
Alias: None
Product: HTML WG
Classification: Unclassified
Component: LC1 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:
: 11173 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-10-29 19:54 UTC by contributor
Modified: 2011-08-04 05:03 UTC (History)
6 users (show)

See Also:


Attachments

Description contributor 2010-10-29 19:54:10 UTC
Section: http://www.whatwg.org/specs/web-apps/current-work/complete.html#the-canvas-state

Comment:
wouldn't it be better to return the context handler instead of void, making
"context.moveTo(x1,y1).lineTo(x2,y2).lineTo..." possible and easier?

Posted from: 84.110.19.97
Comment 1 Ms2ger 2010-10-31 16:19:34 UTC
I don't see the point. If that's what you like, use jQuery.
Comment 2 Ms2ger 2010-10-31 16:19:46 UTC
*** Bug 11173 has been marked as a duplicate of this bug. ***
Comment 3 Aryeh Gregor 2010-11-01 20:00:30 UTC
This is nice in jQuery because it sometimes lets you avoid naming extra variables, e.g. (actual code sample I was just looking at)

  $("body").append("<script></script>").attr("src", foo);

rather than

  var script = document.createElement("script");
  script.src = foo;
  document.body.appendChild(script);

which is necessary when using DOM methods because "script.src = foo" and the equivalent setAttribute() call don't return the element they're operating on, so you need an explicit temporary variable.  But almost any real-world canvas use is going to want to keep around a context handler anyway, so it doesn't look like there's any gain here.  (Although I don't see the harm either.)
Comment 4 Ian 'Hixie' Hickson 2010-12-27 23:54:48 UTC
EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Rejected
Change Description: no spec change
Rationale: Returning self isn't a good design pattern IMHO. It leads to very odd APIs that favour syntactic sugar over conveying logic.
Comment 5 Michael[tm] Smith 2011-08-04 05:03:48 UTC
mass-move component to LC1