CSS Sins

A place to discuss the science of computers and programs, from algorithms to computability.

Formal proofs preferred.

Moderators: phlip, Moderators General, Prelates

User avatar
Xanthir
My HERO!!!
Posts: 5413
Joined: Tue Feb 20, 2007 12:49 am UTC
Location: The Googleplex
Contact:

CSS Sins

Postby Xanthir » Sat Feb 23, 2019 12:11 am UTC

In response to a tweet complaining about non-ASCII characters in JS identifiers from earlier today, I posted the following:

@tabatkins said:

Code: Select all

.ಠ_ಠ { --(╯°□°)╯: ︵┻━┻; } is valid CSS.



Someone then responded that it would be great if that actually flipped a <table>, so I continued to sin:

@tabatkins said:

Code: Select all

registerLayout("table-like", class {
  static inputProperties = ["--(╯°□°)╯"];
  async layout(ch, e, c, props) {
    if(props.get("--(╯°□°)╯").value == "︵┻━┻") {
      // layout upside-down
    } else {
      // layout normally
    }
  }
}



@tabatkins said:

Code: Select all

Plus, in your main page:

CSS.registerProperty({
  name: "--(╯°□°)╯",
  syntax: "┬──┬ | ︵┻━┻",
  initialValue: "┬──┬",
  inherits: false
});



I HAVE TURNED AWAY FROM GOD
(defun fibs (n &optional (a 1) (b 1)) (take n (unfold '+ a b)))

Tub
Posts: 472
Joined: Wed Jul 27, 2011 3:13 pm UTC

Re: CSS Sins

Postby Tub » Mon Feb 25, 2019 9:27 am UTC

Can you please make that css crash the browser? I feel like it should crash the browser.

User avatar
Xenomortis
Not actually a special flower.
Posts: 1448
Joined: Thu Oct 11, 2012 8:47 am UTC

Re: CSS Sins

Postby Xenomortis » Mon Feb 25, 2019 12:31 pm UTC

Dr. Ian Malcolm wrote:Your scientists were so preoccupied with whether they could, they didn't stop to think if they should.
Image

commodorejohn
Posts: 1182
Joined: Thu Dec 10, 2009 6:21 pm UTC
Location: Placerville, CA
Contact:

Re: CSS Sins

Postby commodorejohn » Mon Feb 25, 2019 2:14 pm UTC

I admire its...purity.
"'Legacy code' often differs from its suggested alternative by actually working and scaling."
- Bjarne Stroustrup
www.commodorejohn.com - in case you were wondering, which you probably weren't.

User avatar
Xanthir
My HERO!!!
Posts: 5413
Joined: Tue Feb 20, 2007 12:49 am UTC
Location: The Googleplex
Contact:

Re: CSS Sins

Postby Xanthir » Mon Feb 25, 2019 7:03 pm UTC

There's not *actually* anything particularly weird there, it's just a result of the fact that CSS allows any non-ASCII character to form an ident token (along with ASCII alphanums, dashes, and underscores), which class selectors, property names, and keywords are all made from. So "ಠ_ಠ" is an ident, "--(╯°□°)╯" is an ident (if you're careful to use ideographic parentheses; it won't work with ASCII parens), and then ︵┻━┻ and ┬──┬ are idents.

Probably the odder part is that it uses a custom property, whose only constraint is that it has to be an ident that starts with two dashes. That's what lets the whole thing look so... odd in CSS.
(defun fibs (n &optional (a 1) (b 1)) (take n (unfold '+ a b)))


Return to “Computer Science”

Who is online

Users browsing this forum: No registered users and 6 guests