Skip to content

Commit

Permalink
Fix #258 for real
Browse files Browse the repository at this point in the history
  • Loading branch information
WebReflection committed Jan 22, 2024
1 parent 805060d commit 4eb92b6
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 14 deletions.
6 changes: 3 additions & 3 deletions cjs/interface/attr.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';
const {ATTRIBUTE_NODE} = require('../shared/constants.js');
const {CHANGED, VALUE} = require('../shared/symbols.js');
const {String} = require('../shared/utils.js');
const {String, ignoreCase} = require('../shared/utils.js');
const {attrAsJSON} = require('../shared/jsdon.js');
const {emptyAttributes} = require('../shared/attributes.js');

Expand Down Expand Up @@ -42,8 +42,8 @@ class Attr extends Node {

toString() {
const {name, [VALUE]: value} = this;
return emptyAttributes.has(name) && !value ?
name : `${name}="${value.replace(QUOTE, '"')}"`;
return emptyAttributes.has(name) && !value && ignoreCase(this) ?
name : `${name}="${value.replace(QUOTE, '"')}"`;
}

toJSON() {
Expand Down
6 changes: 3 additions & 3 deletions esm/interface/attr.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {ATTRIBUTE_NODE} from '../shared/constants.js';
import {CHANGED, VALUE} from '../shared/symbols.js';
import {String} from '../shared/utils.js';
import {String, ignoreCase} from '../shared/utils.js';
import {attrAsJSON} from '../shared/jsdon.js';
import {emptyAttributes} from '../shared/attributes.js';

Expand Down Expand Up @@ -41,8 +41,8 @@ export class Attr extends Node {

toString() {
const {name, [VALUE]: value} = this;
return emptyAttributes.has(name) && !value ?
name : `${name}="${value.replace(QUOTE, '"')}"`;
return emptyAttributes.has(name) && !value && ignoreCase(this) ?
name : `${name}="${value.replace(QUOTE, '"')}"`;
}

toJSON() {
Expand Down
6 changes: 1 addition & 5 deletions types/commonjs/perf_hooks.d.cts
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
/// <reference types="node" />
export const performance: import("perf_hooks").Performance | {
now(): number;
};
import { performance } from "perf_hooks";
export const performance: any;
2 changes: 1 addition & 1 deletion types/esm/shared/node.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export function parentElement({ parentNode }: {
parentNode: any;
}): any;
export function previousSibling({ [PREV]: prev }: {
"__@PREV@24211": any;
"__@PREV@24061": any;
}): any;
export function nextSibling(node: any): any;
import { PREV } from './symbols.js';
4 changes: 2 additions & 2 deletions worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -4832,8 +4832,8 @@ let Attr$1 = class Attr extends Node$1 {

toString() {
const {name, [VALUE]: value} = this;
return emptyAttributes.has(name) && !value ?
name : `${name}="${value.replace(QUOTE, '&quot;')}"`;
return emptyAttributes.has(name) && !value && ignoreCase(this) ?
name : `${name}="${value.replace(QUOTE, '&quot;')}"`;
}

toJSON() {
Expand Down

0 comments on commit 4eb92b6

Please sign in to comment.