Skip to content

Commit a83edf3

Browse files
author
Sepand Parhami
authored
Change usage of startsWith for older browsers. (#16)
This makes sure the code works when not polyfilling es2015 methods.
1 parent 234d8b1 commit a83edf3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/object-position.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export function getPositioningTranslate(
5858
// center.
5959
const positionStr = objectPosition || '50% 50%';
6060

61-
const splitIndex = positionStr.startsWith('calc') ?
61+
const splitIndex = positionStr.lastIndexOf('calc', 0) === 0 ?
6262
positionStr.indexOf(')') + 1 : positionStr.indexOf(' ');
6363
const xPos = positionStr.slice(0, splitIndex) || '';
6464
const yPos = positionStr.slice(splitIndex) || '';

0 commit comments

Comments
 (0)