Skip to content

Instantly share code, notes, and snippets.

@rniwa
rniwa / gist:2f14588926e1a11c65d3
Last active August 29, 2015 14:19
Imperative API for Node Distribution in Shadow DOM

Imperative API for Node Distribution in Shadow DOM

There are two approaches to the problem depending on whether we want to natively support redistribution or not.

To recap, a redistribution of a node (N_1) happens when it's distributed to an insertion point (I_1) inside a shadow root (S_1), and I_1's parent also has a shadow root which contains an insertion point which ends picking up N_1. e.g. the original tree may look like:

(host of S_1) - S_1
  + N_1         + (host of S_2) - S_2
                   + I_1           + I_2
@rniwa
rniwa / no-layout.html
Last active August 29, 2015 14:22
no-layout
<!DOCTYPE html>
<html>
<body>
<script>
var NoLayout = (function () {
var layoutGuardCount = 0;
function wrapMethod(name, propertyName) {
if (NoLayout.InProduction)
ENTITY sites
{
int site_id,
string url,
int created_at,
int updated_at
PRIMARY(url)
}
ENTITY users
ENTITY sites
{
int site_id,
string url,
int created_at,
int updated_at
PRIMARY(url)
}
ENTITY users
ENTITY Site
{
string url,
int created_at,
int updated_at
PRIMARY(url)
}
ENTITY User
{
module ActiveRecord
class Schema
def self.define(info={}, &block)
yield block
end
end
end
class PIQLTable
# This file is auto-generated from the current state of the database. Instead of editing this file,
# please use the migrations feature of Active Record to incrementally modify your database, and
# then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your database schema. If you need
# to create the application database on another system, you should be using db:schema:load, not running
# all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended to check this file into your version control system.
@rniwa
rniwa / gist:2491709
Created April 25, 2012 18:01
safari ajax failure reduction attempt
<!DOCTYPE html>
<html>
<head>
<script src="jquery-min.js"></script>
</head>
<body>
<script>
$.ajax({url: 'jquery.js'}).done(function () {
alert('PASS');
Process: Safari [30260]
Path: /Applications/Safari.app/Contents/MacOS/Safari
Identifier: org.webkit.nightly.WebKit
Version: r117439 (117439)
Code Type: X86-64 (Native)
Parent Process: launchd [1832]
Date/Time: 2012-05-17 13:52:51.722 -0700
OS Version: Mac OS X 10.6.8 (10K549)
Report Version: 6
@rniwa
rniwa / RenderBlock.cpp.diff
Created April 18, 2013 21:50
Logging of the number of objects that has floats or regions in the ancestor chain in logicalLeftSelectionOffset and logicalRightSelectionOffset
Index: Source/WebCore/rendering/RenderBlock.cpp
===================================================================
--- Source/WebCore/rendering/RenderBlock.cpp (revision 148625)
+++ Source/WebCore/rendering/RenderBlock.cpp (working copy)
@@ -3703,13 +3703,49 @@
(state == RenderObject::SelectionEnd && !ltr);
}
+#define LSO_LOG 1
+