Giter VIP home page Giter VIP logo

dom-dom-dom.com's Introduction

My and kangax’s idea for Node.js Knockout:

Auto-gathered compatibility tables of browser features

caniuse.com is nice but you still have to write all tests manually. I’d like to automate it by taking slightly different approach: collect serialised window objects of all people visiting the website. This way we get always up to date data.

How would it look like?

dom-dom-dom.com/Object.getOwnPropertyNames shows:
function: Chrome 5+, Firefox 4+, IE 9+, Opera 12+, Safari 5+

dom-dom-dom.com/document.body.style.boxShadow shows:
string: Chrome 10+, Firefox 4+, IE 9+, Opera 10.5+, Safari 5.1+

dom-dom-dom.com/window (the same as dom-dom-dom.com/) lists all its proporties:

  • ArrayBuffer
    • function: Chrome 7+, Firefox 4+, IE 10+, Opera 11.6+, Safari 5.1+
  • document
    • object: all browsers
      • [+] expand
  • ...
  • webkitURL
    • object: Chrome 10+, Safari 5.1+

##TODO

Front-end

Write window to JSON serializer. How to serialize DOM node to JSON?

Submiting data

Send data to the server in the following format:

{
	userAgent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.5 Safari/537.17",
	window: {
		ArrayBuffer: {
			$type: "function",
			arguments: "null",
			caller: "null",
			length: "number",
			name: "string",
			prototype: {
				$type: "object",
				constructor: {$type: "link", keys: ["ArrayBuffer"]},
				slice: {
					$type: "function",
					arguments: "null",
					caller: "null",
					length: "number",
					name: "string",
					prototype: {
						$type: "object",
						constructor: {$type: "link", keys: ["ArrayBuffer", "prototype", "slice"]}
					}
				}
			}
		},
		// ...
	}
}

"null", "string", "number", "boolean", "undefined" are primitive types, they don’t have children. "function" "object", "array" do.

"link" type has an absolute path in its "keys" field.

Back-end

MongoDB Schema

One MongoDB collection:

[
	{
		_id: 'ArrayBuffer',
		types: {
			function: [
				{family: 'Chrome', major: 24, minor: 0, patch: 1312}
				// more browsers
			]
		},
		children: {/* … */}
	},

	{
		_id: 'document',
		types: {
			'object': [
				{family: 'Firefox', major: 24, minor: 0}
				// …
			]
		},
		children: {
			URL: {
				types: {
					'string': []
				},
				children: {}
			},
			activeElement: {
				types: {
					object: [/* ... */]
				},
				children: {
					/* All the way down to the rabbit hole */
				}
			}
		}
	},

	{
		_id: 'window',
		types: {
			link: [
				{family: 'Chrome', major: 24, minor: 0, patch: 1312, value: '/'}
			]
		}
	}
]

Some collection items such as document might be several megabytes big. Let’s see how it’s going to work out.

API

When user opens a home page he receive the following data from api.dom-dom-dom/?depth=1

{
	ArrayBuffer: {
		types: {
			function: [
				{family: 'Chrome', major: 24, minor: 0, patch: 1312}
				// more browsers
			]
		},
		children: {}
	},

	document: {
		types: {
			'object': [
				{family: 'Firefox', major: 24, minor: 0}
				// …
			]
		},
		children: {}
	},

	window: {
		types: {
			link: [
				{family: 'Chrome', major: 24, minor: 0, patch: 1312, value: '/'}
			]
		}
	}
}

The response has the same structure as DB with exception of Mongo’s _id stuff.

depth indicates that I don’t need any children objects. Otherwise the response would be the whole DB.

Parse user agent

tobie/ua-parser. Borrow browserized version from Modernizr.

uaparse(navigator.userAgent)
> UserAgent {
  family: "Chrome",
  major: 24,
  minor: 0,
  patch: 1312
}

By the way

I have dom-dom-dom.com domain. It’s the best name I could came up with but I still don’t like it very much.

I want to build a long-running project. I’m going to maintain it after Node Knockout. I have had the idea for more than 2 years. Node KO is just a kick to start working on it.

dom-dom-dom.com's People

Contributors

nv avatar

Watchers

gotomypc avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.