8000 fix(core): Improved css clip-path parsing by CatchABus · Pull Request #10753 · NativeScript/NativeScript · GitHub
[go: up one dir, main page]

Skip to content

fix(core): Improved css clip-path parsing #10753

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

Merged
merged 1 commit into from
Jun 30, 2025
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 packages/core/ui/styling/style-properties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,19 +201,19 @@ function isNonNegativeFiniteNumber(value: number): boolean {
}

function parseClipPath(value: string): string | ClipPathFunction {
const functionStartIndex = value.indexOf('(');
const funcStartIndex = value.indexOf('(');
const funcEndIndex = value.lastIndexOf(')');

if (functionStartIndex > -1) {
const functionName = value.substring(0, functionStartIndex).trim();
if (funcStartIndex > -1 && funcEndIndex > -1) {
const functionName = value.substring(0, funcStartIndex).trim();

switch (functionName) {
case 'rect':
case 'circle':
case 'ellipse':
case 'polygon':
case 'inset': {
const rule: string = value.replace(`${functionName}(`, '').replace(')', '');
return new ClipPathFunction(functionName, rule);
return new ClipPathFunction(functionName, value.substring(funcStartIndex + 1, funcEndIndex));
}
default:
throw new Error(`Clip-path function ${functionName} is not valid.`);
Expand Down
0