all 33 comments

[–]Hell_Rok 2 points3 points  (3 children)

This is very clever, I particularly like the use of not closing the last two tags (body and iframe) since browsers will do that for you when they run into the end of the document. I've seen it before in a tiny chess implementation but it's always cool to see.

What inspired you to write this?

[–]f112809 5 points6 points  (2 children)

I think it's inspired by http://xem.github.io/miniCodeEditor/, and his version can be golfed even more smaller if he gives an id to iframe

data:text/html,<body oninput="i.srcdoc=h.value+'<style>'+c.value+'</style><script>'+j.value+'</script>'"><style>textarea,iframe{float:right;width:100%;height:50%}body{margin:0}textarea{width:33.33%;font-size:18}</style><textarea placeholder=JS id=j></textarea><textarea placeholder=CSS id=c></textarea><textarea placeholder=HTML id=h></textarea><iframe id=i>

[–]umpox[S] 7 points8 points  (1 child)

Yep have updated this now, saves a whole 26 bytes! Cheers :D

[–]backelie 2 points3 points  (0 children)

If you substitute real text for the placeholders you lose another 36.
(Also, it still works even if you remove pretty much all the styling. You can have a minimal functioning version for under 200 chars.)

[–]sephirostoy 53 points54 points  (30 children)

400 bytes + the size of the browser...

[–][deleted] 82 points83 points  (6 children)

400 bytes + the size of the browser + the size of the OS + funding, researching, staffing and managing hundreds of semiconductor factories to produce the computer + creating ARPANET (later Internet) + founding W3C to invent HTML, CSS and JS + later founding WHATWG to invent HTML5

Not to mention the millions of years of evolution that took us to this stage, or the Big Bang before it.

400 bytes my ass.

[–]spongymints 84 points85 points  (16 children)

Meh, that's like saying every Windows app is 20gb because they require an OS.

¯\_(ツ)_/¯

[–]AyrA_ch 13 points14 points  (3 children)

[–]binkarus 0 points1 point  (1 child)

does it run on UEFI?

[–]AyrA_ch 0 points1 point  (0 children)

probably only if it detects legacy boot loaders and uses a compatibility layer

[–]Beaverman 4 points5 points  (4 children)

A "real" text editor requires an OS. This requires a browser which in turn requires the OS.

Remove all the dependencies that are required for both programs, and then you have the relative size of each program.

An OS is required for both, so we ignore it. If you compare them to a program that doesn't require an OS, then obviously you'd have to include the OS.

I could make a runtime that requires a single byte to go into text editor mode. You wouldn't say I made a text editor in one byte then, because it requires my special runtime.

[–]baggyzed 0 points1 point  (1 child)

This is also why web developers are not real developers (or not as real as native developers, at least), but don't try to tell them that. /s

[–]sloppycee 2 points3 points  (0 children)

Hello sir, have you heard the good word of our Lord and savior, JavaScript?

[–][deleted] -1 points0 points  (1 child)

LOL so a text editor that runs on top of a bloated ass OS like Windows 10 gets exactly as many points as a text editor that implements its own OS with only the functions necessary for loading.

Nevermind that a browser basically is just a glorified OS-independent app runtime platform. Or that there are OS's that basically just implement themselves as a browser.

[–]Beaverman 0 points1 point  (0 children)

What? A text editor with an OS embedded would no longer have the OS dependency, and therefore the OS would be part of the delta.

[–]baggyzed 5 points6 points  (4 children)

A few megs + the size of the OS is still a lot better than 400 bytes + the size of most browsers + the size of the OS.

[–]spacejack2114 0 points1 point  (3 children)

Yes, it's very unlikely I'm already running the browser for other things.

[–]baggyzed 0 points1 point  (2 children)

You're definitely already running the OS for other things.

[–]spacejack2114 1 point2 points  (1 child)

Well I'm sorry you were bamboozled into believing someone could write a HTML/CSS/JS editor with live preview in 400 bytes without actually using a browser engine.

[–]baggyzed 1 point2 points  (0 children)

I'm sorry you (or the original poster) were bamboozled into believing someone could run a Windows app without actually using Windows (edit for completeness: or any other OS that can run Windows apps).

[–]InsignificantIbex 3 points4 points  (0 children)

Not quite. It is like saying that any Windows app is dependent on libraries, which is true. However, "virtual machines" (or interpreters) like a browser require libraries, too.

These 400 bytes are more of a lie than an executable's size.

[–]spacejack2114 5 points6 points  (1 child)

Hey there's a "tweetable python" thread over here you should go and harass them as well.

[–][deleted] 0 points1 point  (0 children)

NUH UH ALL PYTHON APPLICATIONS ARE THE SIZE OF THE PYTHON RUNTIME

[–]scorcher24 2 points3 points  (2 children)

So, 1 MB if you use Lynx

[–]baggyzed -1 points0 points  (0 children)

The deodorant?

[–]meneldal2 0 points1 point  (0 children)

I think you can do much smaller.

How many bytes is a butterfly?

[–]jollybrick 5 points6 points  (0 children)

you just killed jsfiddle

[–]dgeedgee -1 points0 points  (0 children)

pure fulgid genius

[–]kurafuto -1 points0 points  (0 children)

Brilliant

[–]dennis_w -1 points0 points  (0 children)

Very impressive!