-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ee12989
commit 8085ee9
Showing
10 changed files
with
109 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use strict'; | ||
const {VALUE} = require('../shared/symbols.js'); | ||
const {emptyAttributes} = require('../shared/attributes.js'); | ||
const {escape} = require('../shared/text-escaper.js'); | ||
const {Attr} = require('./attr.js'); | ||
|
||
const QUOTE = /"/g; | ||
|
||
/** | ||
* @implements globalThis.Attr | ||
*/ | ||
class XMLAttr extends Attr { | ||
constructor(ownerDocument, name, value = '') { | ||
super(ownerDocument, name, value); | ||
} | ||
|
||
toString() { | ||
const {name, [VALUE]: value} = this; | ||
return emptyAttributes.has(name) && !value ? | ||
name : `${name}="${escape(value).replace(QUOTE, """)}"`; | ||
} | ||
} | ||
exports.XMLAttr = XMLAttr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import {VALUE} from '../shared/symbols.js'; | ||
import {emptyAttributes} from '../shared/attributes.js'; | ||
import {escape} from '../shared/text-escaper.js'; | ||
import {Attr} from './attr.js'; | ||
|
||
const QUOTE = /"/g; | ||
|
||
/** | ||
* @implements globalThis.Attr | ||
*/ | ||
export class XMLAttr extends Attr { | ||
constructor(ownerDocument, name, value = '') { | ||
super(ownerDocument, name, value); | ||
} | ||
|
||
toString() { | ||
const {name, [VALUE]: value} = this; | ||
return emptyAttributes.has(name) && !value ? | ||
name : `${name}="${escape(value).replace(QUOTE, """)}"`; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/** | ||
* @implements globalThis.Attr | ||
*/ | ||
export class XMLAttr extends Attr implements globalThis.Attr { | ||
} | ||
import { Attr } from "./attr.js"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters