Coverage for tdom / htmlspec.py: 100%

7 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-05-03 21:23 +0000

1# See https://developer.mozilla.org/en-US/docs/Glossary/Void_element 

2VOID_ELEMENTS = frozenset( 

3 [ 

4 "area", 

5 "base", 

6 "br", 

7 "col", 

8 "embed", 

9 "hr", 

10 "img", 

11 "input", 

12 "link", 

13 "meta", 

14 "param", 

15 "source", 

16 "track", 

17 "wbr", 

18 ] 

19) 

20 

21 

22CDATA_CONTENT_ELEMENTS = frozenset(["script", "style"]) 

23RCDATA_CONTENT_ELEMENTS = frozenset(["textarea", "title"]) 

24CONTENT_ELEMENTS = CDATA_CONTENT_ELEMENTS | RCDATA_CONTENT_ELEMENTS 

25 

26SVG_TAG_FIX = { 

27 "altglyph": "altGlyph", 

28 "altglyphdef": "altGlyphDef", 

29 "altglyphitem": "altGlyphItem", 

30 "animatecolor": "animateColor", 

31 "animatemotion": "animateMotion", 

32 "animatetransform": "animateTransform", 

33 "clippath": "clipPath", 

34 "feblend": "feBlend", 

35 "fecolormatrix": "feColorMatrix", 

36 "fecomponenttransfer": "feComponentTransfer", 

37 "fecomposite": "feComposite", 

38 "feconvolvematrix": "feConvolveMatrix", 

39 "fediffuselighting": "feDiffuseLighting", 

40 "fedisplacementmap": "feDisplacementMap", 

41 "fedistantlight": "feDistantLight", 

42 "fedropshadow": "feDropShadow", 

43 "feflood": "feFlood", 

44 "fefunca": "feFuncA", 

45 "fefuncb": "feFuncB", 

46 "fefuncg": "feFuncG", 

47 "fefuncr": "feFuncR", 

48 "fegaussianblur": "feGaussianBlur", 

49 "feimage": "feImage", 

50 "femerge": "feMerge", 

51 "femergenode": "feMergeNode", 

52 "femorphology": "feMorphology", 

53 "feoffset": "feOffset", 

54 "fepointlight": "fePointLight", 

55 "fespecularlighting": "feSpecularLighting", 

56 "fespotlight": "feSpotLight", 

57 "fetile": "feTile", 

58 "feturbulence": "feTurbulence", 

59 "foreignobject": "foreignObject", 

60 "glyphref": "glyphRef", 

61 "lineargradient": "linearGradient", 

62 "radialgradient": "radialGradient", 

63 "textpath": "textPath", 

64} 

65 

66 

67SVG_ATTR_FIX = { 

68 "attributename": "attributeName", 

69 "attributetype": "attributeType", 

70 "basefrequency": "baseFrequency", 

71 "baseprofile": "baseProfile", 

72 "calcmode": "calcMode", 

73 "clippathunits": "clipPathUnits", 

74 "diffuseconstant": "diffuseConstant", 

75 "edgemode": "edgeMode", 

76 "filterunits": "filterUnits", 

77 "glyphref": "glyphRef", 

78 "gradienttransform": "gradientTransform", 

79 "gradientunits": "gradientUnits", 

80 "kernelmatrix": "kernelMatrix", 

81 "kernelunitlength": "kernelUnitLength", 

82 "keypoints": "keyPoints", 

83 "keysplines": "keySplines", 

84 "keytimes": "keyTimes", 

85 "lengthadjust": "lengthAdjust", 

86 "limitingconeangle": "limitingConeAngle", 

87 "markerheight": "markerHeight", 

88 "markerunits": "markerUnits", 

89 "markerwidth": "markerWidth", 

90 "maskcontentunits": "maskContentUnits", 

91 "maskunits": "maskUnits", 

92 "numoctaves": "numOctaves", 

93 "pathlength": "pathLength", 

94 "patterncontentunits": "patternContentUnits", 

95 "patterntransform": "patternTransform", 

96 "patternunits": "patternUnits", 

97 "pointsatx": "pointsAtX", 

98 "pointsaty": "pointsAtY", 

99 "pointsatz": "pointsAtZ", 

100 "preservealpha": "preserveAlpha", 

101 "preserveaspectratio": "preserveAspectRatio", 

102 "primitiveunits": "primitiveUnits", 

103 "refx": "refX", 

104 "refy": "refY", 

105 "repeatcount": "repeatCount", 

106 "repeatdur": "repeatDur", 

107 "requiredextensions": "requiredExtensions", 

108 "requiredfeatures": "requiredFeatures", 

109 "specularconstant": "specularConstant", 

110 "specularexponent": "specularExponent", 

111 "spreadmethod": "spreadMethod", 

112 "startoffset": "startOffset", 

113 "stddeviation": "stdDeviation", 

114 "stitchtiles": "stitchTiles", 

115 "surfacescale": "surfaceScale", 

116 "systemlanguage": "systemLanguage", 

117 "tablevalues": "tableValues", 

118 "targetx": "targetX", 

119 "targety": "targetY", 

120 "textlength": "textLength", 

121 "viewbox": "viewBox", 

122 "viewtarget": "viewTarget", 

123 "xchannelselector": "xChannelSelector", 

124 "ychannelselector": "yChannelSelector", 

125 "zoomandpan": "zoomAndPan", 

126} 

127 

128 

129# Used for fragments that do not have a tag 

130# to assume that text is inside this element. 

131DEFAULT_NORMAL_TEXT_ELEMENT = "div"