From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: None (mailfrom) identity=mailfrom; client-ip=8.23.224.62; helo=out.smtp-auth.no-ip.com; envelope-from=kevin@carhart.net; receiver= Received: from out.smtp-auth.no-ip.com (smtp-auth.no-ip.com [8.23.224.62]) by hurricane.the-brannons.com (Postfix) with ESMTPS id F235F77C83 for ; Sat, 19 Aug 2017 16:33:09 -0700 (PDT) X-No-IP: carhart.net@noip-smtp X-Report-Spam-To: abuse@no-ip.com Received: from carhart.net (unknown [99.52.200.227]) (Authenticated sender: carhart.net@noip-smtp) by smtp-auth.no-ip.com (Postfix) with ESMTPA id 96FA328C; Sat, 19 Aug 2017 16:33:23 -0700 (PDT) Received: from carhart.net (localhost [127.0.0.1]) by carhart.net (8.13.8/8.13.8) with ESMTP id v7JNXMAN017719; Sat, 19 Aug 2017 16:33:22 -0700 Received: from localhost (kevin@localhost) by carhart.net (8.13.8/8.13.8/Submit) with ESMTP id v7JNXMnQ017716; Sat, 19 Aug 2017 16:33:22 -0700 Date: Sat, 19 Aug 2017 16:33:21 -0700 (PDT) From: Kevin Carhart To: Karl Dahlke cc: Edbrowse-dev@lists.the-brannons.com In-Reply-To: <20170719190803.eklhad@comcast.net> Message-ID: References: <20170719113834.eklhad@comcast.net> <20170719190803.eklhad@comcast.net> User-Agent: Alpine 2.03 (LRH 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Subject: Re: [Edbrowse-dev] acid[0] X-BeenThere: edbrowse-dev@lists.the-brannons.com X-Mailman-Version: 2.1.24 Precedence: list List-Id: Edbrowse Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Aug 2017 23:33:11 -0000 On Sat, 19 Aug 2017, Karl Dahlke wrote: > Well duktape has some json support out of the box. > It has a JSON global object, with JSON.parse() in it and I don't know what else, so using js to convert css to json might be a practical pathway. Correction: Actually I made a mistakes that it was JSON. The parser doesn't return JSON, the parser returns a tree of nested objects. The documentation simply turned it into JSON in order to serialize the contents of the object for readability. So this is even more familiar, just traversal with recursion maybe. > Course we'd have to follow up with a function to apply bgcolor=white to > foo.style wherever that makes sense. I think that's right. We might get the first two thirds of a three step process done "free" by the libraries and have to write the function that you describe. Since querySelectorAll returns elements (foo) and the parser css.js breaks down selectors, attribute names (bgcolor) and attribute values (white) into neat compartments, I think it would be (don't want to speak too soon) somewhat straightforward to dole out bgcolor=white to foo.style. Here is the code for the parser and then for querySelector: https://raw.githubusercontent.com/jotform/css.js/master/css.js https://raw.githubusercontent.com/yiminghe/query-selector/master/build/query-selector-debug.js And here are the git projects: https://github.com/jotform/css.js.git https://github.com/yiminghe/query-selector.git K