@khanacademy/wonder-blocks-core
Advanced tools
Comparing version 6.4.0 to 6.4.1
# @khanacademy/wonder-blocks-core | ||
## 6.4.1 | ||
### Patch Changes | ||
- 5dfac06e: Allow all special characters in IDs, except whitespace. | ||
## 6.4.0 | ||
@@ -4,0 +10,0 @@ |
@@ -292,7 +292,3 @@ import * as React from 'react'; | ||
_hasValidIdChars(value) { | ||
if (typeof value !== "string") { | ||
return false; | ||
} | ||
const invalidCharsReplaced = value.replace(/[^\d\w-]/g, "-"); | ||
return value === invalidCharsReplaced; | ||
return typeof value === "string" ? !/\s/.test(value) : false; | ||
} | ||
@@ -299,0 +295,0 @@ } |
@@ -315,7 +315,3 @@ 'use strict'; | ||
_hasValidIdChars(value) { | ||
if (typeof value !== "string") { | ||
return false; | ||
} | ||
const invalidCharsReplaced = value.replace(/[^\d\w-]/g, "-"); | ||
return value === invalidCharsReplaced; | ||
return typeof value === "string" ? !/\s/.test(value) : false; | ||
} | ||
@@ -322,0 +318,0 @@ } |
@@ -25,2 +25,6 @@ import type { IIdentifierFactory } from "./types"; | ||
* here because all identifiers are prefixed to avoid needing that check. | ||
* | ||
* According to this post: | ||
* https://stackoverflow.com/questions/70579/html-valid-id-attribute-values/31773673#31773673 | ||
* The only characters that are not allowed in an id are whitespace characters. | ||
*/ | ||
@@ -27,0 +31,0 @@ _hasValidIdChars(value?: string | null): boolean; |
{ | ||
"name": "@khanacademy/wonder-blocks-core", | ||
"version": "6.4.0", | ||
"version": "6.4.1", | ||
"design": "v1", | ||
@@ -5,0 +5,0 @@ "publishConfig": { |
@@ -48,3 +48,3 @@ import UniqueIDFactory from "../unique-id-factory"; | ||
test("special characters in scope, throws", () => { | ||
test("special characters in scope, should not throw", () => { | ||
// Arrange | ||
@@ -57,3 +57,3 @@ const scope = "invalid$%^&*("; | ||
// Assert | ||
expect(underTest).toThrowErrorMatchingSnapshot(); | ||
expect(underTest).not.toThrow(); | ||
}); | ||
@@ -60,0 +60,0 @@ }); |
@@ -36,10 +36,9 @@ import type {IIdentifierFactory} from "./types"; | ||
* here because all identifiers are prefixed to avoid needing that check. | ||
* | ||
* According to this post: | ||
* https://stackoverflow.com/questions/70579/html-valid-id-attribute-values/31773673#31773673 | ||
* The only characters that are not allowed in an id are whitespace characters. | ||
*/ | ||
_hasValidIdChars(value?: string | null): boolean { | ||
if (typeof value !== "string") { | ||
return false; | ||
} | ||
const invalidCharsReplaced = value.replace(/[^\d\w-]/g, "-"); | ||
return value === invalidCharsReplaced; | ||
return typeof value === "string" ? !/\s/.test(value) : false; | ||
} | ||
@@ -46,0 +45,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
259540
5078