A pure JavaScript library for DOM manipulation, events, and animations. It provides a familiar chaining syntax while utilizing modern browser APIs for maximum performance.
Include the minified script in your HTML file before your custom scripts.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>My App</title>
</head>
<body>
<h1>Hello World</h1>
<!-- Include SR JS -->
<script src="sr.min.js"></script>
<!-- Your Code -->
<script>
// Wait for DOM Ready
$(function() {
$('h1').text('SR JS is working!');
});
</script>
</body>
</html>
You can easily extend the library with custom plugins or static methods.
Use $.plugin to add methods available on SR objects (like $('div').myMethod()).
$.plugin('color', function(color) {
// 'this' refers to the SR object
this.css('color', color);
return this; // Enable chaining
});
// Usage
$('p').color('red');
Use $.method to add utility functions directly to the $ object.
$.method('sum', function(a, b) {
return a + b;
});
// Usage
console.log($.sum(10, 20)); // 30
Browse the documentation for available methods and plugins:
This library relies on modern JavaScript features including Proxy, WeakMap, and structuredClone. Below is the minimum browser support matrix.
| Browser | Version | Release Date |
|---|---|---|
| Google Chrome | 98+ | Feb 2022 |
| Mozilla Firefox | 94+ | Nov 2021 |
| Apple Safari | 15.4+ | Mar 2022 |
| Microsoft Edge | 98+ | Feb 2022 |