Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent CHTML adaptice CSS from adding character CSS multiple times #796

Merged
merged 1 commit into from
May 1, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions ts/output/chtml/Usage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,13 @@

/**
* Class used for tracking usage of font characters or wrappers
* (should extend Set<T>, but that doesn't work for compiling to ES2015).
*/
export class Usage<T> {

/**
* The used items.
*/
protected used: Set<T> = new Set<T>();
protected used: Set<string> = new Set<string>();

/**
* The items marked as used since last update.
Expand All @@ -41,18 +40,19 @@ export class Usage<T> {
* @param {T} item The item that has been used
*/
public add(item: T) {
if (!this.used.has(item)) {
const name = JSON.stringify(item);
if (!this.used.has(name)) {
this.needsUpdate.push(item);
}
this.used.add(item);
this.used.add(name);
}

/**
* @param {T} item The item to check for being used
* @return {boolean} True if the item has been used
*/
public has(item: T): boolean {
return this.used.has(item);
return this.used.has(JSON.stringify(item));
}

/**
Expand Down