Top Related Projects
jQuery JavaScript Library
MooTools Core Repository
Dojo 1 - the Dojo 1 toolkit core library.
JavaScript's utility _ belt
AngularJS - HTML enhanced for web apps!
Quick Overview
YUI3 (Yahoo User Interface Library 3) is a free, open-source JavaScript and CSS library for building richly interactive web applications. It was developed by Yahoo! and provides a comprehensive set of utilities, controls, and widgets for creating dynamic and responsive user interfaces.
Pros
- Modular architecture allowing developers to use only the components they need
- Extensive documentation and examples
- Cross-browser compatibility
- Built-in performance optimization features
Cons
- No longer actively maintained (officially deprecated since 2014)
- Larger file size compared to more modern alternatives
- Steeper learning curve for beginners
- Outdated compared to current web development practices and frameworks
Code Examples
- Creating a simple YUI instance:
YUI().use('node', function(Y) {
var node = Y.one('#myElement');
node.set('innerHTML', 'Hello, YUI3!');
});
- Making an AJAX request:
YUI().use('io-base', function(Y) {
Y.io('https://api.example.com/data', {
on: {
success: function(id, response) {
console.log(response.responseText);
}
}
});
});
- Creating a custom event:
YUI().use('event-custom', function(Y) {
var myEvent = new Y.CustomEvent('myCustomEvent');
myEvent.on(function(e) {
console.log('Custom event fired!', e);
});
myEvent.fire({data: 'Some data'});
});
Getting Started
To get started with YUI3, follow these steps:
- Include the YUI seed file in your HTML:
<script src="https://yui-s.yahooapis.com/3.18.1/build/yui/yui-min.js"></script>
- Create a basic YUI instance and use modules:
YUI().use('node', 'event', function(Y) {
Y.one('#myButton').on('click', function(e) {
alert('Button clicked!');
});
});
Note: As YUI3 is deprecated, it's recommended to use more modern alternatives for new projects.
Competitor Comparisons
jQuery JavaScript Library
Pros of jQuery
- Smaller file size and faster load times
- Simpler syntax and easier learning curve for beginners
- More widespread adoption and larger community support
Cons of jQuery
- Less comprehensive feature set compared to YUI3
- Limited built-in UI components and widgets
- Lacks modular architecture for better organization of large-scale applications
Code Comparison
YUI3:
YUI().use('node', 'event', function(Y) {
Y.one('#myButton').on('click', function(e) {
Y.one('#myDiv').setStyle('color', 'red');
});
});
jQuery:
$(document).ready(function() {
$('#myButton').click(function() {
$('#myDiv').css('color', 'red');
});
});
Both examples demonstrate event handling and DOM manipulation, but YUI3 uses a modular approach with its use()
method, while jQuery's syntax is more concise. YUI3 provides a sandboxed Y
instance, whereas jQuery uses the global $
function. The jQuery code is shorter and arguably more intuitive for simple tasks, but YUI3's structure offers better organization for complex applications.
MooTools Core Repository
Pros of MooTools Core
- Smaller file size and faster load times
- More flexible and customizable architecture
- Better support for object-oriented programming concepts
Cons of MooTools Core
- Smaller community and ecosystem compared to YUI3
- Less comprehensive documentation and learning resources
- Fewer built-in UI components and widgets
Code Comparison
MooTools Core:
var myElement = document.id('myElement');
myElement.addEvent('click', function() {
this.toggleClass('active');
});
YUI3:
YUI().use('node', function(Y) {
var myElement = Y.one('#myElement');
myElement.on('click', function() {
this.toggleClass('active');
});
});
Both libraries provide similar functionality for DOM manipulation and event handling, but MooTools Core uses a more concise syntax. YUI3 requires a module loading step and wraps functionality in a YUI instance, while MooTools Core extends native objects directly.
Dojo 1 - the Dojo 1 toolkit core library.
Pros of Dojo
- More active development and maintenance
- Better support for modern JavaScript features and ES6+ syntax
- Stronger focus on modular architecture and AMD (Asynchronous Module Definition)
Cons of Dojo
- Steeper learning curve for beginners
- Less extensive documentation compared to YUI3
- Smaller community and ecosystem
Code Comparison
YUI3:
YUI().use('node', 'event', function(Y) {
Y.one('#myButton').on('click', function(e) {
alert('Button clicked!');
});
});
Dojo:
require(['dojo/dom', 'dojo/on'], function(dom, on) {
on(dom.byId('myButton'), 'click', function() {
alert('Button clicked!');
});
});
Both frameworks provide similar functionality for DOM manipulation and event handling, but Dojo's syntax is more aligned with modern JavaScript practices. YUI3 uses a global YUI
object and a callback function, while Dojo employs AMD-style module loading.
Dojo's approach offers better modularity and dependency management, making it easier to organize and maintain large-scale applications. However, YUI3's syntax may be more intuitive for developers familiar with jQuery or other older JavaScript libraries.
Overall, Dojo is better suited for modern web development, while YUI3 may be preferred for legacy projects or developers accustomed to its syntax and ecosystem.
JavaScript's utility _ belt
Pros of Underscore
- Lightweight and focused on utility functions
- Easier to learn and integrate into existing projects
- Still actively maintained and widely used
Cons of Underscore
- Less comprehensive than YUI3's full framework approach
- Lacks built-in UI components and modules
- May require additional libraries for more complex applications
Code Comparison
YUI3:
YUI().use('node', 'event', function(Y) {
Y.one('#myButton').on('click', function(e) {
alert('Button clicked!');
});
});
Underscore:
_.each([1, 2, 3], function(num) {
console.log(num);
});
YUI3 provides a more structured approach with modules and a global Y
object, while Underscore focuses on utility functions that can be easily chained or used independently.
YUI3 offers a comprehensive framework with UI components, DOM manipulation, and event handling. It's suitable for large-scale applications but has a steeper learning curve and is no longer actively maintained.
Underscore, on the other hand, is a lightweight library that provides functional programming helpers. It's easier to integrate into existing projects and is still actively maintained. However, it may require additional libraries for more complex applications.
AngularJS - HTML enhanced for web apps!
Pros of Angular.js
- More modern and actively maintained framework
- Robust two-way data binding and dependency injection
- Large community and extensive ecosystem of plugins/extensions
Cons of Angular.js
- Steeper learning curve, especially for beginners
- Can be overkill for smaller projects
- Performance issues with large-scale applications
Code Comparison
YUI3:
YUI().use('node', 'event', function(Y) {
Y.one('#myButton').on('click', function(e) {
alert('Button clicked!');
});
});
Angular.js:
angular.module('myApp', [])
.controller('MyController', function($scope) {
$scope.clickButton = function() {
alert('Button clicked!');
};
});
Summary
Angular.js offers a more comprehensive framework for building modern web applications, with features like two-way data binding and dependency injection. However, it comes with a steeper learning curve and potential performance issues for large-scale apps. YUI3, while no longer actively maintained, provides a simpler approach that may be suitable for smaller projects or developers familiar with its ecosystem. The code comparison shows the different approaches to handling events and structuring applications between the two frameworks.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
YUI 3: The Yahoo User Interface Library
YUI is a free, open source JavaScript and CSS framework for building richly interactive web applications. YUI is provided under a BSD license and is available on GitHub for forking and contribution.
Links
- Home Page
- Documentation
- Blog
- Latest Production Release
- Forums
- License
- Contributor Info
- Contributor Mailing List
- Report a Bug
- Shifter, for building YUI
Source Info
This is the active working source tree for YUI 3. It contains work in progress toward the next YUI 3 releases and may be unstable.
We encourage you to use the latest source for evaluation purposes, testing new features and bug fixes, and to provide feedback on new functionality. Please refer to the "Latest Production Release" link above if you're looking for the latest stable release of YUI recommended for production use.
If you plan on contributing to YUI, please join and monitor the "Contributor Mailing List" listed above. Information about milestones and tree closures will be made available there.
Branch Information
YUI's development happens on five main branches. The following describes what each of these code branches represents:
-
live-docs
: Represents the latest GA release of YUI, plus any documentation-only updates. Any tweaks or additions to the docs for the latest release happen on this branch, and they are reflected on the website. -
master
: (Read-only) Contains everything inlive-docs
, plus code changes that will go into the next YUI release. The code changes inmaster
are either bug fixes or small changes which should not break API compatibility. Patch releases will be cut from this branch; e.g. 3.6.x. All code in this branch has fully passed all unit tests and should be stable. -
3.x
: (Read-only) Represents the next major YUI release; e.g. 3.7.0. This is an integration branch which contains everything inmaster
, plus larger code changes which will go into a future YUI release. The changes in3.x
require a minor version increment before they are part of release, e.g., 3.7.0. Preview Releases will be cut from this branch for developers to test and evaluate. All code in this branch has fully passed all unit tests and should be stable. -
dev-master
anddev-3.x
: Current working branches containing code that has not been through the CI process. Developers check their changes in to these integration branches for the automated testing system to validate. Once they are validated, the code is merged intomaster
and3.x
respectively. Never check in tomaster
or3.x
directly. -
release-3.x.x
: Short-lived release branches where code checkins are carefully managed for extensive testing and release deployment.
Source Tree
The YUI source tree includes the following directories:
-
build
: Built YUI source files. The built files are generated at development time from the contents of thesrc
directory. The build step generates debug files (unminified and with full comments and logging), raw files (unminified, but without debug logging), and minified files (suitable for production deployment and use). -
src
Raw unbuilt source code (JavaScript, CSS, image assets, ActionScript files, etc.) for the library. Beginning with YUI 3.4.0, thesrc
directory also contains all module-specific documentation, tests and examples. All modifications to the library and its documentation should take place in this directory.
Initial Setup
- Fork the project on GitHub (https://github.com/yui/yui3).
- Clone the fork to your local environment for development.
Do Good Stuff
- Create a feature branch to house atomic code changes.
git checkout -b myfeature upstream/master --no-track
- Satisfy the contribution requirements (see YUI Contribution Standards).
- Push changes to your fork.
- Submit a pull request from your fork to the
live-docs
,dev-master
, ordev-3.x
branch for review. - Incorporate community feedback.
- Push changes to your fork -- the pull request will automatically update.
- Rinse and repeat.
All changes should continue to be made on the feature branch; that way the pull request you submit will automatically update to include them. Make sure to keep the feature branch updated with the latest changes from master, so that they don't diverge during your development process.
Important Tips
- Always work from a feature branch. Since all code submissions will be through a Pull Request, feature branches isolate changes from one submission to another.
- Always start your new branch from the branch you want to submit to:
git checkout -b myfeature dev-master
- Remember to submit your Pull Request to the proper
dev-
branch and notmaster
or3.x
.
Building
To build YUI components install Shifter (npm -g install shifter
)
and then simply run shifter
in that components directory.
Shifter also allows you to rebuild the entire YUI src tree:
cd yui3/src && shifter --walk
Top Related Projects
jQuery JavaScript Library
MooTools Core Repository
Dojo 1 - the Dojo 1 toolkit core library.
JavaScript's utility _ belt
AngularJS - HTML enhanced for web apps!
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot