Skip to content

Commit 83ab282

Browse files
vintaclaude
andcommitted
docs: update browser API usage examples in README
Replace deprecated methods with current API: - Remove spacingElementById/ByClassName/ByTagName methods - Update to use spacingNode() with standard DOM selectors - Add comments explaining the current approach 🤖 Generated with Claude Code (https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 1cd2e0d commit 83ab282

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,10 @@ Learn more on [npm](https://www.npmjs.com/package/pangu).
6363
const text = pangu.spacingText('當你凝視著bug,bug也凝視著你');
6464
// text = '當你凝視著 bug,bug 也凝視著你'
6565
66-
pangu.spacingElementById('main');
67-
pangu.spacingElementByClassName('comment');
68-
pangu.spacingElementByTagName('p');
66+
// Process specific elements using spacingNode()
67+
pangu.spacingNode(document.getElementById('main'));
68+
document.querySelectorAll('.comment').forEach(el => pangu.spacingNode(el));
69+
document.querySelectorAll('p').forEach(el => pangu.spacingNode(el));
6970
7071
document.addEventListener('DOMContentLoaded', () => {
7172
// listen to any DOM change and automatically perform spacing via MutationObserver()
@@ -83,9 +84,10 @@ Learn more on [npm](https://www.npmjs.com/package/pangu).
8384
const text = pangu.spacingText('這個人老是在寫程式,是不是有bin啊?');
8485
// text = '這個人老是在寫程式,是不是有 bin 啊?'
8586
86-
pangu.spacingElementById('main');
87-
pangu.spacingElementByClassName('comment');
88-
pangu.spacingElementByTagName('p');
87+
// Process specific elements using spacingNode()
88+
pangu.spacingNode(document.getElementById('main'));
89+
document.querySelectorAll('.comment').forEach(el => pangu.spacingNode(el));
90+
document.querySelectorAll('p').forEach(el => pangu.spacingNode(el));
8991
</script>
9092
```
9193

0 commit comments

Comments
 (0)