Commit 2d6251d5 authored by Zéfling's avatar Zéfling 🎨
Browse files

add base element argument for : class, first, list

updage README, remove Github link
parent 8b9b7c25
#### netbeans ####
nbproject
#### backup #####
.bak
*.bak
......
......@@ -7,10 +7,10 @@ The idea is for the formatter is to approach the formatting possibilities of fmt
### Examples :
```js
"Il y a {0, number, #,##0:fr} jour{0, choice,1<=|1>s}"._format(1200); // Il y a 1 200 jours
"Il y a {jours, number, #,##0:fr} jour{jours, choice,1<=|1>s}"._format({jours : 1}); // Il y a 1 jour
"Rendez-vous le {date, date, dd/MM/yyyy}"._format({date : '2016-04-10'}); // Rendez-vous le 10/04/2016
"Le resultat est {0, choice, 10<{1}|10>={2}}."._format([12, 'petit', 'grand']); // Le resultat est grand.
'Il y a {0, number, #,##0:fr} jour{0, choice,1<=|1>s}'._format(1200); // 'Il y a 1 200 jours'
'Il y a {jours, number, #,##0:fr} jour{jours, choice,1<=|1>s}'._format({jours : 1}); // 'Il y a 1 jour'
'Rendez-vous le {date, date, dd/MM/yyyy}'._format({date : '2016-04-10'}); // 'Rendez-vous le 10/04/2016'
'Le resultat est {0, choice, 10<{1}|10>={2}}.'._format([12, 'petit', 'grand']); // 'Le resultat est grand.'
```
## DOM
......@@ -24,7 +24,18 @@ baku.dom.list('h2 + div')
._rmClass('ko');
```
# Test
## Compilation
```bash
# dom + formatter
compress.sh full
# dom only
compress.sh dom
# formatter only
compress.sh
```
## Test
See the test page: http://test.ikilote.net/BakuJS/test.html
......
......@@ -4,49 +4,53 @@ baku.dom = {
* @param id the id element
* @return HTMLElement
*/
'id' : function (id) { return document.getElementById(id) },
'id' : function (id) { return document.getElementById(id); },
/**
* get a elements by name ( name="xxx" )
* @param name the name element
* @param element base HTMLElement
* @return HTMLElement
*/
'name' : function (name) { return document.getElementsByName(name) },
'name' : function (name, element) { return (element || document).getElementsByName(name); },
/**
* get all elements that containts all classes list in params ( class="xxx yyy" )
* @param classes class list (separete with space)
* @param element base HTMLElement
* @return NodeList
*/
'class' : function (classes) { return document.getElementsByClassName(classes) },
'class' : function (classes, element) { return (element || document).getElementsByClassName(classes); },
/**
* get all elements that respect a selector
* @param selector CSS selector
* @return HTMLElement
* @param element base HTMLElement
* @return HTMLCollection
*/
'first' : function (selector) { return document.querySelector(selector) },
'first' : function (selector, element) { return (element || document).querySelector(selector); },
/**
* get all elements that respect a selector
* @param selector CSS selector
* @return NodeList
* @param element base HTMLElement
* @return HTMLElement or null with no result
*/
'list' : function (selector) { return document.querySelectorAll(selector) },
'list' : function (selector, element) { return (element || document).querySelectorAll(selector); },
/**
* create a element
* @param name name element
* @return HTMLElement
* @return NodeList
*/
'new' : function (name) { return document.createElement(name) },
'new' : function (name) { return document.createElement(name); },
/**
* create fragment document
* @param name name element
* @return DOM fragment
*/
'frag' : function (name) { return document.createDocumentFragment(name) },
'frag' : function (name) { return document.createDocumentFragment(name); },
/**
* create de text element
* @param text text
* @return DOM text
*/
'text' : function (text) { return document.createTextNode(text) }
'text' : function (text) { return document.createTextNode(text); }
};
// copy Array object in DomArray
......
......@@ -8,6 +8,5 @@
<h1>BakuJS</h1>
<p>Documentation : <a href="site/doc-fr.html">Français</a></p>
<p>Voir la <a href="test.html">page test</a></p>
<a href="https://github.com/Zefling/BakuJS"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" /></a>
</body>
</html>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment