NEW: poodle.js
Post new topic   Reply to topic   Printer Friendly Page     Forum IndexCVS Info
Author Message
DJ Maze
Developer


Joined: Apr 19, 2004
Posts: 5668
Location: http://tinyurl.com/5z8dmv

PostPost subject: NEW: poodle.js
Posted: Tue Apr 13, 2010 9:18 pm
Reply with quote

Hi all,

i've worked hard the last months on a new JavaScript library.

Why new?
Well there are many like; DOJO, Yahoo, Prototype, Jquery, Moo Tools, PI, etc. but, i didn't like them to much to implement by default.

poodle.js is my first attempt to write a DOM/ECMA 262 compatible library.
This is different then the other libraries because it is a DOM extending library.
For example jQuery uses $() and creates an object around a HTMLElement with custom functions.
Poodle just extends the HTMLElement with unknown DOM functions and shortened aliases.

So basically $() returns the real object instead of a wrapper.

Say IE8 is missing object.addEventListener() so poodle.js creates that function.

Current support for non-existing methods and properties:

Array
  • every()
  • filter()
  • forEach()
  • indexOf()
  • lastIndexOf()
  • map()
  • some()

Boolean
  • toJSON()

Date
  • toJSON()

Number
  • toJSON()

String
  • toJSON()

Document
  • defaultView (IE8+)
  • getElementsByClassName()
  • addEventListener()
  • removeEventListener()
  • dispatchEvent()

Element
  • click()
  • getBoundingClientRect()
  • getElementsByClassName()
  • textContent (IE8+)
  • classList
  • addEventListener()
  • removeEventListener()
  • dispatchEvent()

Element.style
  • getPropertyValue()
  • getPropertyCSSValue()
  • removeProperty()
  • setProperty()
  • cssRules
  • ownerNode

CSSStyleSheet
  • insertRule()
  • deleteRule()
  • sheet (IE8+)

Event
  • stopPropagation()
  • preventDefault()
  • preventCapture()
  • initEvent()
  • initMouseEvent()

Window
  • DOMParser
  • addEventListener()
  • removeEventListener()
  • dispatchEvent()
  • getComputedStyle()
  • JSON

and many more......

Try it out and keep track of it!

Comments are welcome Wink

More info:
www.w3.org/DOM/Activity.html
www.w3.org/TR/REC-DOM-Level-1/
www.w3.org/TR/DOM-Level-2-Core/
www.w3.org/TR/DOM-Level-2-Events/
www.w3.org/TR/DOM-Level-2-Style/
www.w3.org/TR/DOM-Leve...sal-Range/
www.w3.org/TR/DOM-Level-2-Views/
www.w3.org/TR/DOM-Level-2-HTML/
www.w3.org/TR/DOM-Level-3-Core/
www.w3.org/TR/DOM-Level-3-Events/
www.w3.org/TR/cssom-view/
www.w3.org/TR/html5/dom.html
www.w3.org/TR/selectors-api/


DJ Maze's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Fedora 12 / 2.2.15 / 5.1.47 / 5.3.3 / CVS


Last edited by DJ Maze on Sun Apr 18, 2010 8:47 pm; edited 1 time in total
Back to top
View user's profile Visit poster's website Yahoo Messenger
DJ Maze
Developer


Joined: Apr 19, 2004
Posts: 5668
Location: http://tinyurl.com/5z8dmv

PostPost subject: Re: NEW: poodle.js
Posted: Sun Apr 18, 2010 8:35 pm
Reply with quote

UPDATE:
  • added HTML5 getElementsByClassName()
  • added JavaScript 1.6 Array functions


DJ Maze's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Fedora 12 / 2.2.15 / 5.1.47 / 5.3.3 / CVS
Back to top
View user's profile Visit poster's website Yahoo Messenger
radiogetswild
500+ Posts Club


Joined: Apr 22, 2004
Posts: 685
Location: UK

PostPost subject: Re: NEW: poodle.js
Posted: Mon Apr 19, 2010 8:58 am
Reply with quote

Q How big are these new Poodles ?

small, mediam or large cos whatever size they are I might have to get a bigger bucket and mop to clean up the mess lol

have a great days guys n gals


radiogetswild's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
MySQL Version 5.0.45 PHP Version 5.2.6 apache is 1.3.41 Dragonfly 9.2.1 Windows Vista
Back to top
View user's profile Send e-mail Visit poster's website Yahoo Messenger
DJ Maze
Developer


Joined: Apr 19, 2004
Posts: 5668
Location: http://tinyurl.com/5z8dmv

PostPost subject: Re: NEW: poodle.js
Posted: Fri Apr 23, 2010 9:04 pm
Reply with quote

Thanks tim!

NEW UPDATE: Added Selectors API support.

Accessible through the document.$Q() and element.$Q() functions.
Using slickspeed tests it is the fastest. WOOHOO!

RUN THE TEST

Example:
Code:
// Select all even td's from all table.forumline tbody's
Poodle.$Q("table.forumline > tbody > td:nth-child(even)")

// Select all odd td's from all table.forumline tbody's
Poodle.$Q("table.forumline > tbody > td:nth-child(odd)")


More info about CSS selectors:
www.w3.org/TR/CSS2/selector
www.w3.org/TR/css3-selectors


DJ Maze's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Fedora 12 / 2.2.15 / 5.1.47 / 5.3.3 / CVS
Back to top
View user's profile Visit poster's website Yahoo Messenger
NanoCaiordo
Developer


Joined: Jun 29, 2004
Posts: 3677
Location: Melbourne, AU

PostPost subject: Re: NEW: poodle.js
Posted: Sat Apr 24, 2010 2:57 am
Reply with quote

Unbelievable!

Can also see how fast Opera JS engine is.

_________________
.:: I met php the 03 December 2003 :: Unforgettable day! ::.

NanoCaiordo's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
MySQL 5.1 / PHP 5.3 / NextGen()
Back to top
View user's profile Visit poster's website
NanoCaiordo
Developer


Joined: Jun 29, 2004
Posts: 3677
Location: Melbourne, AU

PostPost subject: Re: NEW: poodle.js
Posted: Sun May 02, 2010 1:05 am
Reply with quote

While converting existing scripts to use only poodle I've found that getName is not IE friendly yet ... or IE is not getName friendly lmao

TypeError: Object doesn't support support this property or method in ...

Works in all browsers but IE.

_________________
.:: I met php the 03 December 2003 :: Unforgettable day! ::.

NanoCaiordo's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
MySQL 5.1 / PHP 5.3 / NextGen()
Back to top
View user's profile Visit poster's website
Ertan
I18N / L10N Lead Dev


Joined: Apr 21, 2004
Posts: 98
Location: Germany

PostPost subject: Re: NEW: poodle.js
Posted: Fri May 21, 2010 9:39 pm
Reply with quote

amazing
_________________
.: USE THE FORCE :.

Ertan's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Back to top
View user's profile Send e-mail Visit poster's website
DJ Maze
Developer


Joined: Apr 19, 2004
Posts: 5668
Location: http://tinyurl.com/5z8dmv

PostPost subject: Re: NEW: poodle.js
Posted: Thu Aug 05, 2010 9:17 pm
Reply with quote

Update:
added support for IE 9 Preview 4
added support for ElementTraversal
renamed getName() to lowerName() #151664
renamed $IE to $IE7 for better understanding
improved UA detection (BSD, SunOS)
improved defineProperty() support (firefox)
improved extendDOM() to support defineProperty() to set properties
removed getOpacity() and setOpacity() for defineProperty() method
removed getNodesByClassName()
removed getSheet()
set cookie PoodleTimezoneOffset


DJ Maze's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Fedora 12 / 2.2.15 / 5.1.47 / 5.3.3 / CVS
Back to top
View user's profile Visit poster's website Yahoo Messenger
greenday2k
Forum Admin


Joined: Aug 11, 2005
Posts: 484
Location: CO

PostPost subject: Re: NEW: poodle.js
Posted: Fri Aug 06, 2010 5:15 am
Reply with quote

Whoa, THATS FAST. Tested with Firefox 4.02 B.
_________________
www.greenday2k.net



greenday2k's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Back to top
View user's profile Visit poster's website MSN Messenger Yahoo Messenger
NanoCaiordo
Developer


Joined: Jun 29, 2004
Posts: 3677
Location: Melbourne, AU

PostPost subject: Re: NEW: poodle.js
Posted: Wed Sep 15, 2010 10:42 pm
Reply with quote

Code:
/*    MOO CMS, Copyright (c) since 2005 The MOO Dev. Group. All rights reserved.
    $Revision: 1.1 $
*/

// attach to window onload event
Poodle.onDOMReady(Tabs);

function Tabs() {
    init();
    function init() {
        var x=-1,y,z,t,n,nodes=$D().getElementsByClassName("tabs", "ul");
        while(nodes[++x]) {
            y=-1;
            while(t=nodes[x].childNodes[++y]){
                if("li"!=t.nodeName.toLowerCase()) {continue;}
                for(z=0;z<t.childNodes.length;++z) {
                    n=t.childNodes[z];
                    if("a"==n.nodeName.toLowerCase()) {
                        n.bind("click",show_tab);
                    }
                }
            }
        }
    }
    function show_tab(e) {
        var i,
            li=e.currentTarget.parentNode,
            items=li.parentNode.$T("li");
        for (i=0;i<items.length;++i) { items[i].removeClass("current"); }
        li.className += " current";
//        e.removeEventListener("click", show_tab);
    }
}

Converted to use Poodle but IE7 (not sure about other versions) refuse to understand obj.bind and obj.addEventListener.
Am I doing something wrong?

Quote:
TypeError: Obejct doesn't support this property or method in ...

_________________
.:: I met php the 03 December 2003 :: Unforgettable day! ::.

NanoCaiordo's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
MySQL 5.1 / PHP 5.3 / NextGen()
Back to top
View user's profile Visit poster's website
DJ Maze
Developer


Joined: Apr 19, 2004
Posts: 5668
Location: http://tinyurl.com/5z8dmv

PostPost subject: Re: NEW: poodle.js
Posted: Tue Oct 05, 2010 3:46 pm
Reply with quote

Code:
nodes[x].childNodes[++y]
This fails because childNodes don't use $IE7() to extend the DOM functionality.
Known problem of IE7 because IE7 can't extend elements on its own.
Instead it is easier to use:
Code:
function Tabs()
{
	var i=0, n, nodes = $Q("ul.tabs > li > a.tab, ul.tabs > li > div.tabcontent");
	while (n = nodes[i++])
	{
		if ("a" == n.lowerName()) {
			n.bind("click", show_tab);
		}
		if ("div" == n.lowerName())
		{
			n.resizer = new MOO.Resizer(n, 0, 200, null, n);
		}
	}
$Q() is the CSS based QuerySelector.
Since we only want the direct children A and DIV from ul > li to attach the event handler and resizer this is the best method.
Aside from the $IE7() issue we also loop through all childNodes to fetch the one we need and match the class.
A query selector can make that much much easier.

Now you see how Poodle makes life much easier doesn't it?

You understand, implement and test?


DJ Maze's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Fedora 12 / 2.2.15 / 5.1.47 / 5.3.3 / CVS
Back to top
View user's profile Visit poster's website Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic   Printer Friendly Page     Forum IndexCVS Info All times are GMT
Page 1 of 1


Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

stopsoftwarepatents.eu petition banner
User Info [x]

Welcome Anonymous

Nickname
Password
(Register)

Last CVS commits [x]

Languages [x]

Community [x]

Support for DragonflyCMS in a other languages:

Deutsch
Español

X-links [x]
UltraEdit Browse Happy logo Firefox MySQL PostgreSQL Valid CSS! Valid XHTML 1.0! Unicode Encoded Badge NukeBiz Resources Raven DragonflyCMS Dedicated Now InsideSupport Lampe Berger

Preview theme [x]
Each user can view the site with a different theme.
Themes marked with a * also change the forum look.


You are seeing squares or questionmarks on this page?

All content of this website is copyrighted by the Creative Commons NC-SA
The logos and trademarks used on this site are the property of their respective owners
We are not responsible for comments posted by our users, as they are the property of the poster.
Our server runs on a P3 1.2GHz with 512MB RAM with no accelerators
Support GoPHP5.org
This page generated in 1.2276 seconds with 19 DB Queries in 0.244 seconds
Memory Usage: 3 MB
Interactive software released under GNU GPL, Code Credits, Privacy Policy