Skip to content
Permalink
Browse files
First parameter to SVGDocument.createEvent() should be mandatory
https://bugs.webkit.org/show_bug.cgi?id=160296

Reviewed by Alex Christensen.

Source/WebCore:

First parameter to SVGDocument.createEvent() should be mandatory:
- https://www.w3.org/TR/SVG2/struct.html#InterfaceDocumentExtensions
- https://dom.spec.whatwg.org/#document

This patch drops createEvent() from SVGDocument so that the spec-compliant
Document.createEvent() is used instead. In the specification, SVGDocument
no longer exists and is a simple Document.

Firefox and Chrome agree with the specification.

Test: svg/dom/SVGDocument-createEvent.html

* svg/SVGDocument.idl:

LayoutTests:

Add test coverage.

* svg/dom/SVGDocument-createEvent-expected.txt: Added.
* svg/dom/SVGDocument-createEvent.html: Added.


Canonical link: https://commits.webkit.org/178449@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@203821 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
cdumez committed Jul 28, 2016
1 parent c3260b3 commit ea7aa65fc7f7f304436250d1f730b2f9d51801a3
Showing 5 changed files with 62 additions and 5 deletions.
@@ -1,3 +1,15 @@
2016-07-28 Chris Dumez <cdumez@apple.com>

First parameter to SVGDocument.createEvent() should be mandatory
https://bugs.webkit.org/show_bug.cgi?id=160296

Reviewed by Alex Christensen.

Add test coverage.

* svg/dom/SVGDocument-createEvent-expected.txt: Added.
* svg/dom/SVGDocument-createEvent.html: Added.

2016-07-28 Chris Dumez <cdumez@apple.com>

Parameters to CanvasGradient.addColorStop() should be mandatory
@@ -0,0 +1,12 @@
Test SVGDocument.createEvent() operation.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


PASS svgDocument.createEvent() threw exception TypeError: Not enough arguments.
PASS event = svgDocument.createEvent('mouseevent') did not throw exception.
PASS event.__proto__ is MouseEvent.prototype
PASS successfullyParsed is true

TEST COMPLETE

@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<body>
<script src="../../resources/js-test-pre.js"></script>
<script>
description("Test SVGDocument.createEvent() operation.");

var svgDocument = document.implementation.createDocument("http://www.w3.org/2000/svg", "svg");
shouldThrow("svgDocument.createEvent()", "'TypeError: Not enough arguments'");
shouldNotThrow("event = svgDocument.createEvent('mouseevent')");
shouldBe("event.__proto__", "MouseEvent.prototype");

</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>
@@ -1,3 +1,24 @@
2016-07-28 Chris Dumez <cdumez@apple.com>

First parameter to SVGDocument.createEvent() should be mandatory
https://bugs.webkit.org/show_bug.cgi?id=160296

Reviewed by Alex Christensen.

First parameter to SVGDocument.createEvent() should be mandatory:
- https://www.w3.org/TR/SVG2/struct.html#InterfaceDocumentExtensions
- https://dom.spec.whatwg.org/#document

This patch drops createEvent() from SVGDocument so that the spec-compliant
Document.createEvent() is used instead. In the specification, SVGDocument
no longer exists and is a simple Document.

Firefox and Chrome agree with the specification.

Test: svg/dom/SVGDocument-createEvent.html

* svg/SVGDocument.idl:

2016-07-28 Chris Dumez <cdumez@apple.com>

Parameters to CanvasGradient.addColorStop() should be mandatory
@@ -21,10 +21,6 @@

// FIXME: This interface no longer exists in SVG2.
interface SVGDocument : XMLDocument {
readonly attribute SVGSVGElement rootElement;

// Overwrite the one in events::DocumentEvent
// FIXME: Using "undefined" as default parameter value is wrong.
[RaisesException] Event createEvent(optional DOMString eventType = "undefined");
readonly attribute SVGSVGElement? rootElement;
};

0 comments on commit ea7aa65

Please sign in to comment.