Last change
on this file since 6a80231 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | 'use strict';
|
---|
2 |
|
---|
3 | const { detachNodeFromParent } = require('../lib/xast.js');
|
---|
4 |
|
---|
5 | exports.name = 'removeDoctype';
|
---|
6 | exports.type = 'visitor';
|
---|
7 | exports.active = true;
|
---|
8 | exports.description = 'removes doctype declaration';
|
---|
9 |
|
---|
10 | /**
|
---|
11 | * Remove DOCTYPE declaration.
|
---|
12 | *
|
---|
13 | * "Unfortunately the SVG DTDs are a source of so many
|
---|
14 | * issues that the SVG WG has decided not to write one
|
---|
15 | * for the upcoming SVG 1.2 standard. In fact SVG WG
|
---|
16 | * members are even telling people not to use a DOCTYPE
|
---|
17 | * declaration in SVG 1.0 and 1.1 documents"
|
---|
18 | * https://jwatt.org/svg/authoring/#doctype-declaration
|
---|
19 | *
|
---|
20 | * @example
|
---|
21 | * <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
|
---|
22 | * q"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
---|
23 | *
|
---|
24 | * @example
|
---|
25 | * <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
---|
26 | * "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" [
|
---|
27 | * <!-- an internal subset can be embedded here -->
|
---|
28 | * ]>
|
---|
29 | *
|
---|
30 | * @author Kir Belevich
|
---|
31 | *
|
---|
32 | * @type {import('../lib/types').Plugin<void>}
|
---|
33 | */
|
---|
34 | exports.fn = () => {
|
---|
35 | return {
|
---|
36 | doctype: {
|
---|
37 | enter: (node, parentNode) => {
|
---|
38 | detachNodeFromParent(node, parentNode);
|
---|
39 | },
|
---|
40 | },
|
---|
41 | };
|
---|
42 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.