Skip to main content

Home/ javascript/ Group items tagged with

Rss Feed Group items tagged

yc c

moo.fx - size does matter - 1 views

  •  
    moo.fx is a superlightweight, ultratiny, megasmall javascript effects library, to be used with prototype.js or the mootools framework. It's very easy to use, blazing fast, cross-browser, standards compliant, provides controls to modify any CSS property of any HTML element, including colors, with builtin checks that won't let a user break the effect with multiple, crazy clicks. Optimized to make you write the lesser code possible, the new moo.fx is so modular you can create any kind of effect with it. moo.fx is open source, released under the very liberal MIT License, so feel free to do anything you want with
Javier Neira

Perfection kills » Understanding delete - 3 views

  • All because it’s not possible to delete variables in Javascript. At least not when declared in such way.
  • It’s almost as if Firebug follows some other rules of deletion. It is Firebug that has led Stoyan astray! So what is really going on here?
  • we need to understand how delete operator works in Javascript: what exactly can and cannot be deleted and why.
  • ...35 more annotations...
  • var o = { x: 1 }; delete o.x; // true o.x; // undefined
  • var x = 1; delete x; // false x; // 1
  • function x(){} delete x; // false typeof x; // "function"
  • Note that delete only returns false when a property can not be deleted.
  • variable instantiation and property attributes
  • Global code, Function code and Eval code.
  • When a source text is treated as a Program, it is executed in a global scope, and is considered a Global code.
  • Anything that’s executed directly within a function is, quite obviously, considered a Function code. In browsers, content of event attributes (e.g. <p onclick="...">) is usually parsed and treated as a Function code.
  • text that’s supplied to a built-in eval function is parsed as Eval code. We will soon see why this type is special.
  • And now that we know the difference between property assignment and variable declaration — latter one sets DontDelete, whereas former one doesn’t — it should be clear why undeclared assignment creates a deletable property:
  • As you can see, execution contexts can logically form a stack. First there might be Global code with its own execution context; that code might call a function, with its own execution context; that function could call another function, and so on and so forth. Even if function is calling itself recursively, a new execition context is being entered with every invocation.
  • Every execution context has a so-called Variable Object associated with it. Similarly to execution context, Variable object is an abstract entity, a mechanism to describe variable instantiation. Now, the interesing part is that variables and functions declared in a source text are actually added as properties of this Variable object.
  • When control enters execution context for Global code, a Global object is used as a Variable object. This is precisely why variables or functions declared globally become properties of a Global object:
  • The behavior is actually very similar: they become properties of Variable object. The only difference is that when in Function code, a Variable object is not a Global object, but a so-called Activation object. Activation object is created every time execution context for Function code is entered.
  • and a special Arguments object (under arguments name). Note that Activation object is an internal mechanism and is never really accessible by program code.
  • within Eval code are created as properties of calling context’s Variable object. Eval code simply uses Variable object of the execution context that it’s being called within:
  • Execution context When ECMAScript code executes, it always happens within certain execution context.
  • When declared variables and functions become properties of a Variable object — either Activation object (for Function code), or Global object (for Global code), these properties are created with DontDelete attribute. However, any explicit (or implicit) property assignment creates property without DontDelete attribute. And this is essentialy why we can delete some properties, but not others:
  • Special arguments variable (or, as we know now, a property of Activation object) has DontDelete. length property of any function instance has DontDelete as well:
  • As you might remember, undeclared assignment creates a property on a global object.
  • Now that it’s clear what happens with variables (they become properties), the only remaining concept to understand is property attributes. Every property can have zero or more attributes from the following set — ReadOnly, DontEnum, DontDelete and Internal. These attributes serve as sort of flags — an attribute can either exist on a property or not. For the purposes of today’s discussion, we are only interested in DontDelete.
  • Variables declared within Eval code are actually created as properties without DontDelete:
  • This interesting eval behavior, coupled with another aspect of ECMAScript can technically allow us to delete non-deletable properties. The thing about function declarations is that they can overwrite same-named variables in the same execution context:
  • Note how function declaration takes precedence and overwrites same-named variable (or, in other words, same property of Variable object). This is because function declarations are instantiated after variable declarations, and are allowed to overwrite them
  • If we declare function via eval, that function should also replace that property’s attributes with its own. And since variables declared from within eval create properties without DontDelete, instantiating this new function should essentially remove existing DontDelete attribute from the property in question, making that property deletable (and of course changing its value to reference newly created function).
  • Unfortunately, this kind of spoofing doesn’t work in any implementation I tried. I might be missing something here, or this behavior might simply be too obscure for implementors to pay attention to
  • this.x = 1; delete x; // TypeError: Object doesn't support this action
  • var x = 1; delete this.x; // TypeError: Cannot delete 'this.x'
  • It’s as if variable declarations in Global code do not create properties on Global object in IE.
  • Not only is there an error, but created property appears to have DontDelete set on it, which of course it shouldn’t have:
  • “The global variable object is implemented as a JScript object, and the global object is implemented by the host.
  • Note how this and window seem to reference same object (if we can believe === operator), but Variable object (the one on which function is declared) is different from whatever this references.
  • delete doesn’t differentiate between variables and properties (in fact, for delete, those are all References) and really only cares about DontDelete attribute (and property existence).
  • The moral of the story is to never trust host objects.
  • Few restrictions are being introduced. SyntaxError is now thrown when expression in delete operator is a direct reference to a variable, function argument or function identifier. In addition, if property has internal [[Configurable]] == false, a TypeError is thrown:
Mike Chelen

JavaScript & MySQL With Jaxer - 0 views

  •  
    Wouldn't it be cool if you could work with MySQL within your JavaScript code? Think about it, you wouldn't have to spend extra time writing extra server-side code for connecting to, querying, and parsing results, you could just write a little bit more code in your JavaScript and be done with it. Of course, we wouldn't want any of this SQL exposed to the end-user, as that would be a major security issue, but what if that problem was solved as well? You might also raise the point that you'd still need the ability to prepare your SQL statements that take dynamic input to prevent SQL injection attacks, but if that weren't an issue, wouldn't that be awesome as well?
Javier Neira

InfoQ: ECMAScript 5 released - 1 views

  • The introduction of strict mode aims to avoid common coding problems in ECMAScript applications. This is achieved with the presence of a lone string literal in a unit (script or function): "use strict;"
  • for either the entire script (if at the top of the script) or for a single function (if the first part of a function).
  • var i=3 is needed
  • ...10 more annotations...
  • and introducing new variables through eval cannot occu
  • delete cannot be used against arguments, functions or variables or other properties with the configurable flag set to false
  • with statements, often a source of errors, are no longer used and considered syntax errors
  • Functions can no longer have duplicate arguments with the same name Objects can no longer have duplicate properties with the same name
  • Access to the global object becomes a runtime error
  • A new JSON object with parse and stringify to support efficient generation of JSON data; like eval but without the security implications of being able to reduce code
  • Array now has standard functions, such as indexOf(), map(), filter(), and reduce()
  • Object now has seal()
  • and freeze()
  • Object.getPrototypeof() returns the prototype of the given object
mikhail-miguel

Web 2.0 and grudge free buttons generator! - 0 views

  •  
    You can create a web 2.0 button in only 4 steps. You can paint your button with preloaded web 2.0 icons or upload your personal icon and customize the font of the text inserted. Enjoy with php, gd2 and Photoshop base button and jquery ajax powered. Hosting, housing windows and linux domain with php, mysql, gd2.
aghaaliabbas

Classifieds Script | Classified Script - 0 views

  •  
    Launch your classfied ads website with few clicks. A powerful php script with 12 professional themes. A complete solution to your needs.
Hussain M Elius

Creating a "Filterable" Portfolio with jQuery - NETTUTS - 0 views

  •  
    If you have worked in your field for a while, there is a pretty good chance that you have a rather extensive portfolio. To make it a little easier to navigate, you will probably be tempted to break them into different categories. In this tutorial, I will show you how to make "filtering by category" a little more interesting with just a little bit of jQuery
Julian Knight

Home - chain.js - GitHub - 0 views

  •  
    JQuery plugin that allows creation of html client-side using templates. Integration with jquery makes the process simple and compatible with events so that DOM manipulation stays consistent. See also interaction.js at http://github.com/raid-ox/interaction.js/wikis. This extends some easy interactions to chain such as drag and drop and sorting. Also usage tutorial at: http://zparse.net.tc/
Julian Knight

Eloquent JavaScript -- interactive tutorial - 0 views

  •  
    Eloquent JavaScript is a digital book providing a comprehensive introduction (tutorial) to the JavaScript programming language. Apart from a bookful of text, it contains plenty of example programs, and an environment to try them out and play with them. The book is aimed at the beginning programmer ― people with prior programming experience might also get something out of it, but they should not read chapters 2 to 5 too closely, because most of the concepts discussed there will probably be nothing new to them. Do make sure you read the end of the first chapter, which has some essential information about the book itself. The book is freely available, and may be used (as a whole or in parts) in any way you see fit, as long as I am credited as the original author. A copy of the book for off-line reading can be downloaded as a zip file, and a more easily printable version can be found here.
Bartłomiej Małysz

Galleriffic | flickr like jQuery web gallery script - 0 views

  •  
    Galleriffic was inspired by Mike Alsup's Cycle plugin, but with performance in mind for delivering a high volume of photos. This is my first experiment with jQuery, so I would love feedback on how to improve this plugin. I am not so great at spelling, and it was much later that I realized that the more appropriate spellings would be Gallerific or Gallerrific, but is too late now for a name change, so Galleriffic remains.
yc c

Reflect-o-matic - 1 views

  •  
    Reflection.js works well with logos, icons and dynamic image content such as forum avatars. Reflection.js comes into it's own with forum avatars; you can apply a reflection effect to every avatar on your forum or blog without any additional server work.
yc c

jQuery Desktop - 5 views

  •  
    JavaScript desktop environment built with jQuery. (with links to reference)
Julian Knight

Jash: JavaScript Shell - 4 views

  •  
    "Jash is a DHTML-based window that gives you command-line JavaScript access to the current browser window. With this console you can quickly debug scripts, manipulate the DOM, view the current page's objects, functions, and variables, execute arbitrary Javascript, enter new CSS (in IE, Firefox, Opera, and Safari), and much more." - A useful tool to execute JavaScript, make live (temporary) CSS changes to a page, discover the page structure, etc. for developers. Written totally in JavaScript so can be used on any platform with any browser. Include in your own pages for debugging or load via a bookmarklet to run on any page.
Julian Knight

Chris Adams: Cleaning up the web with jQuery and a little help from Google - 2 views

  •  
    How to use JQuery (or other libraries) in a bookmarklet! With an example of making textarea's resizeable. Chris Adams provides a template for creating your own bookmarklet and explains some of the reasons you might want to use this technique for development and testing. He also points out some gotcha's to be careful of.
  •  
    How to use JQuery (or other libraries) in a bookmarklet! With an example of making textarea's resizeable. Chris Adams provides a template for creating your own bookmarklet and explains some of the reasons you might want to use this technique for development and testing. He also points out some gotcha's to be careful of.
yc c

Raphaël-Vector Graphics JavaScript Library - 0 views

  •  
    Raphaël is a small JavaScript library that should simplify your work with vector graphics on the web. If you want to create your own specific chart or image crop and rotate widget, for example, you can achieve it simply and easily with this library.
Javier Neira

HtmlUnit - Welcome to HtmlUnit - 2 views

  •  
    HtmlUnit is a "GUI-Less browser for Java programs". It models HTML documents and provides an API that allows you to invoke pages, fill out forms, click links, etc... just like you do in your "normal" browser. It has fairly good JavaScript support (which is constantly improving) and is able to work even with quite complex AJAX libraries, simulating either Firefox or Internet Explorer depending on the configuration you want to use. It is typically used for testing purposes or to retrieve information from web sites. HtmlUnit is not a generic unit testing framework. It is specifically a way to simulate a browser for testing purposes and is intended to be used within another testing framework such as JUnit or TestNG. Refer to the document "Getting Started with HtmlUnit" for an introduction. HtmlUnit is used as the underlying "browser" by different Open Source tools like Canoo WebTest, JWebUnit, WebDriver, JSFUnit, Celerity, ... HtmlUnit was originally written by Mike Bowler of Gargoyle Software and is released under the Apache 2 license. Since then, it has received many contributions from other developers, and would not be where it is today without their assistance.
Javier Neira

How To Make Firebug's JavaScript Debugger Break Inside Dynamic JavaScript Using The 'de... - 0 views

  • The Problem With Dynamic JavaScript However, what if the JavaScript file where you need to set breakpoints is not static but instead dynamic (generated on the fly). If you set a breakpoint in this case and reload the page, the breakpoint will most likely disappear, especially if the JavaScript url is generated uniquely every time. The Solution If you have access to the source, the solution comes in the form of the debugger; keyword. Just add it to your dynamic JavaScript generator or into any JavaScript file you have access to exactly where you want Firebug to break, and voila – it does.
  • More so, this method also works in Google Chrome and IE (if you have Microsoft Script Debugger)
  •  
    The Problem With Dynamic JavaScript However, what if the JavaScript file where you need to set breakpoints is not static but instead dynamic (generated on the fly). If you set a breakpoint in this case and reload the page, the breakpoint will most likely disappear, especially if the JavaScript url is generated uniquely every time. The Solution If you have access to the source, the solution comes in the form of the debugger; keyword. Just add it to your dynamic JavaScript generator or into any JavaScript file you have access to exactly where you want Firebug to break, and voila - it does.
yc c

Underscore.js - 4 views

  •  
    Underscore is a utility-belt library for Javascript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in Javascript objects. It's the tie to go along with jQuery's tux.
  •  
    Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects. It's the tie to go along with jQuery's tux. Collections each, map, reduce, detect, select, reject, all, any, include, invoke, pluck, max, min, sortBy, sortedIndex, toArray, size Arrays first, last, compact, flatten, without, uniq, intersect, zip, indexOf, lastIndexOf Functions bind, bindAll, delay, defer, wrap, compose Objects keys, values, extend, clone, isEqual, isElement, isArray, isFunction, isUndefined Utility noConflict, identity, uniqueId, template
vikas_jk

Useful Javascript Unit Testing Frameworks - QA With Experts - 0 views

  •  
    Javascript Unit testing frameworks list with it's features and which one you should use.
Felipp Crawly

Thank You OPS - 1 views

started by Felipp Crawly on 03 Jan 13 no follow-up yet
1 - 20 of 100 Next › Last »
Showing 20 items per page