Commit graph

87 commits

Author SHA1 Message Date
Isiah Meadows
20f0759103
Fix docs (#2482)
* Fix #2414, address part of #1687

Also cleared the CSS up to be a lot more readable instead of smooshed
into a single line.

* Redo the testing docs page

- Addresses another part of #1687
- Also, fix a few linter issues in the ospec binary

* Add note about third-party cookies, tweak a line

* Make the JSX comparison much more meaningful

And let the code speak for itself. Don't fuel the flame wars any more
than what they've already become. We should be *unopinionated*, and so
I've updated those docs to remove the existing opinion.

* Remove a bunch of outdated ES6 references

* Remove the CSS page
2019-07-23 16:33:56 -04:00
Ayush Jain
982fdf5737 Corrected the case issue of 'JavaScript' throughout the docs (#2401)
* corrected JavaScript spelling
2019-04-01 08:14:38 -04:00
Isiah Meadows
26b8d994ce
Remove m.prop + m.withAttr (#2317)
* Remove `m.prop` + `m.withAttr`

- For many uses, `m.withAttr` is *more* verbose than just directly using
  an event handler
- If you're using it with a bound callback, you're literally wasting a
  single character in the human readable version (and you're *saving*
  them in the minified output).
- It sometimes obscures your intent, if overused.
- Functions are easier to compress than `m.withAttr`, resulting in
  slightly smaller bundles.
- `m.withAttr` is overused anyways.
- `m.prop` is basically useless without `m.withAttr`, and the API
  doesn't have the same benefits it had with 0.2.x.

* Update changelog
2018-11-30 20:41:24 -05:00
Isiah Meadows
7d8a889506 Fix docs bug, advise against reusing vnode.attrs itself (#2250)
* Fix docs bug, advise against reusing `vnode.attrs` itself [skip ci]
* Be consistent + correct with commas [skip ci]
* Be consistent with spacing [skip ci]
* Discard the unused parameters [skip ci]
* Kill an opinion, slim down the example [skip ci]
2018-11-28 09:19:52 +01:00
Scotty Simpson
52ccea2cad Component docs update: an effective compromise re: state & syntactic variance (#2294)
* Update components.md

* Update components.md

* Update components.md

* Update components.md

* Update docs/components.md

Co-Authored-By: CreaturesInUnitards <portrayme@mac.com>

* Update docs/components.md

Co-Authored-By: CreaturesInUnitards <portrayme@mac.com>

* Update docs/components.md

Co-Authored-By: CreaturesInUnitards <portrayme@mac.com>

* teeny clarification

* reasonably compromised language, I think
2018-11-14 19:38:25 -05:00
spacejack
a147023f4e Docs - prioritize closure components for state (#2292)
* Emphasize closure components in components.md

* Use closure components for all stateful component examples

* Add change-log entry

* Edits and separate sections for closure, class & POJO state
2018-11-13 01:04:04 -05:00
Isiah Meadows
b9c3c6c9c8
Remove a section that's 1. buggy and 2. controversial [skip ci] (#2265)
See discussion in #2250 and #1986 for more details.
2018-10-28 17:00:47 -04:00
Pat Cavit
6fb77b7771
docs: update with latest fixes (#2116) 2018-04-12 00:11:11 -07:00
Pat Cavit
b71dc2762e docs: merge latest docs from next 2017-05-01 22:46:23 -07:00
Pat Cavit
3ab20205ee docs: fix typo 2017-04-07 13:12:19 -07:00
André Luiz dos Santos
ec915bf919 Typo 2017-04-03 14:46:53 -03:00
Pat Cavit
207dea91da docs: merge 7ba74ad and friends 2017-03-28 11:37:07 -07:00
Pat Cavit
e88bddb3c8 docs: docs fixes and changelog 2017-03-27 15:14:36 -07:00
Pat Cavit
46ebb340d1 merge: next onto master 2017-03-27 14:21:52 -07:00
Isiah Meadows
40637fe99f Update components.md [ci skip] 2017-03-27 12:41:45 -04:00
Pierre-Yves Gerardy
f7450c96b0 Document closure components (formerly known as "factory components") and flesh out class components docs 2017-03-27 16:47:45 +02:00
Pat Cavit
33aa1fa735 docs: merge docs from next to master 2017-03-24 15:36:53 -07:00
Barney Carroll
57d3de1e5c Docs: component props aren't copied to instances 2017-02-26 17:29:43 +00:00
Leo
65941d1416 document classes 2017-02-19 08:29:35 -05:00
Leo
1620b147da clean up repo 2017-01-30 11:18:47 -05:00
Leo
6ab2b6b6c3 merge to next 2017-01-30 11:04:14 -05:00
Leo
aee13901d8 docs tweaks 2017-01-26 20:46:32 -05:00
Leo Horie
b957bf66e8 expand section on fat components 2017-01-12 12:55:40 -05:00
Leo Horie
6ff5265bf8 docs on animation and css 2017-01-11 13:36:05 -05:00
Leo
31177c279f fix component docs 2017-01-08 15:42:51 -05:00
Leo Horie
bedcd8bdbf update docs re:onbeforeremove and clean up 2016-12-26 12:28:13 -05:00
Leo Horie
a18aadc837 Merge pull request #1431 from barneycarroll/demystify-component-antipatterns
Demystify component antipatterns
2016-11-28 09:19:21 -05:00
Barney Carroll
f040bfe470 Typos 2016-11-27 15:24:34 +00:00
Barney Carroll
b399af1073 Add vnode mutation warning under components documentation 2016-11-27 15:04:03 +00:00
Barney Carroll
1dd341fff5 Typo 2016-11-27 12:50:45 +00:00
Barney Carroll
2f5fe86caf Revert & fine-tune wording 2016-11-27 12:49:38 +00:00
Barney Carroll
a835e6ac6a Rephrase 'restrictive interfaces' & 'magic indices' to reflect common concerns 2016-11-27 12:17:00 +00:00
spacejack
2a6011e2c1 Add notes about passing data to components, avoid inadvertant lifecycle hooks. 2016-11-20 17:58:23 -05:00
maks feltrin
df517bf636 docs typo? 2016-10-22 16:45:19 +02:00
Carl Mungazi
00adb7ae0e Update components.md (#1337)
Fixed typos.
2016-09-23 16:11:28 -07:00
Scott Simpson
3f70d20bb1 fix component name 2016-09-20 09:53:25 -07:00
Leo Horie
80c25e3809 rename routeresolver methods to {onmatch,view}
expose some piecemeal modules
rename internal xhr to request
mirror internal stream api to match public api
2016-08-17 00:10:47 -04:00
Leo Horie
a988276e9b Revert "don't copy state anymore"
This reverts commit cece44d4ac.
2016-07-08 10:24:48 -04:00
Leo Horie
cece44d4ac don't copy state anymore 2016-07-08 00:40:52 -04:00
Leo Horie
7318a0d88b update docs re: component anti-patterns, lint docs 2016-07-07 13:23:16 -04:00
Leo Horie
4b6c4254ba s/shouldUpdate/onbeforeupdate 2016-06-06 09:59:35 -04:00
Leo Horie
0ed3d20c4c documentation fixes 2016-05-26 15:21:30 -04:00
Leo Horie
5815a590a8 test empty object 2016-05-24 23:18:11 -04:00
Richard Ivan
63d67e1d71 typo
typo
2016-05-24 16:44:50 +02:00
Leo Horie
e24e4e9a1a style fixes in docs 2016-05-19 01:46:46 -04:00
Leo Horie
cd8b8b12e6 Some documentation 2016-05-19 01:22:01 -04:00
Alexandr Panchenko
4e8ca4035c ContactList → ContactForm 2016-05-17 17:50:47 +03:00
Leo Horie
13fdb60f66 clean slate 2016-04-20 20:01:04 -04:00
pelonpelon
dc36588160 components.md - eliminate global variable introduced in previous commit
Oops!
2015-07-07 09:04:08 -05:00
pelonpelon
7ce8429bf4 Update components.md -- "Classic MVC" example
@ArthurClemens pointed out in this gitter comment:
https://gitter.im/lhorie/mithril.js?at=55664ba1d21e5ed02ff06e54
that the Classic MVC example is broken:
https://lhorie.github.io/mithril/components.html#classic-mvc

I wanted to show a working jsfiddle with these changes applied, but I couldn't figure out how to get a POST request working. I do, however, have a jsbin that is working, although there are significant changes in the code to allow for GET and POST.
http://jsbin.com/cokesu/2/edit?js,output

A redraw is called for every character entered in the jsbin but AFAICT, not in this PR. I don't know why. It's as though `oninput` is really `onchange`. It's possible to limit the redraw to once when the "save" button is clicked, but this requires a change in logic:

var ContactForm = {
    controller: function(args) {
        this.contact = m.prop(new Contact())
        this.save = function(contact) {
           Observable.trigger("saveContact", {contact: contact})
        }
    },
    view: function(ctrl, args) {
        var contact = ctrl.contact()

        return m("form", [
            m("label", "Name"),
            m("input[name=name]"),

            m("label", "Email"),
            m("input[name=email]"),

            m("button[type=button]", {onclick: function(){
              contact = {
                name: m.prop(this.parentNode.elements.name.value),
                email: m.prop(this.parentNode.elements.email.value)
              }
              ctrl.save(contact)
            
            }}, "Save")
        ])
    }
}
2015-05-28 03:47:40 -05:00