npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

xiyueta

v1.3.8

Published

JavaScript library for html string operations

Downloads

7

Readme

xiyueta.js

解析html网页、css样式、asp程序,使用jQuery语法来遍历操作dom结构。

image

立即体验

在线Demo

常用功能一览

> xiyueta().text() 获取匹配全部文本
> xiyueta().html() 获取匹配第一个HTML
> xiyueta().find() 获取匹配元素后代
> xiyueta().add() 追加新的匹配元素
> xiyueta().not() 删除匹配元素
> xiyueta().is() 检测匹配元素
> xiyueta().prop() 检测获得元素属性值
> xiyueta().attr() 第一个元素的属性值
> xiyueta().removeAttr() 删除元素属性
> xiyueta().css() 设置CSS属性
> xiyueta().val() 表单元素的值
> xiyueta().remove() 删除回调一组列表
> xiyueta().each() 遍历匹配元素
> xiyueta().addClass() 类添加到元素中
> xiyueta().hasClass() 搜索元素中类
> xiyueta().removeClass() 移除元素类
> xiyueta().wrap() 包裹到元素周围
> xiyueta().unwrap() 移除元素父元素
> xiyueta().parse() 解析html字符串
> xiyueta().debug() 打印html结构
> xiyueta().print() 打印HTML内容...

浏览器兼容性

Chrome(及同内核的浏览器如QQ浏览器、360浏览器等等),Firefox,Safari,IE 11

1. 安装包

npm i xiyueta

yarn add xiyueta

2. 在nodejs里使用xiyueta

const xiyueta = require('xiyueta');
const $ = xiyueta.load('<h2 class="Title">Hello world</h2>');

$('h2').text(123);
$('h2.title').addClass('xyt');

$.html();
//=><h2 class="Title xyt">123</h2>

3. 在网页里使用xiyueta

<script src="https://www.xiyueta.com/js/xiyueta.min.js"></script>
<script>
var html='<span>xiyueta</span><span>JS库</span>';
$().parse(html);
$.log($("span").text());
</script>

4. 在asp程序里使用xiyueta

<script  language="javascript" runat="server" src="dist/asp.xiyueta.min.js"></script> 
<%
'这里需要运行一段ASP程序,下面才可以正常运行javascript程序,疑问?'
console.log(xiyueta("title").parse("<title>hello world!</title>").text()) 'ASP里不可以用 $ 直接用 xiyueta代替
%>

<script language="javascript" runat="server">
  console.log($("title").parse("<title>hello world!</title>").text()); //上面要运行一段ASP程序,这里才不会报错,因为要用到ASP程序里的response.write输出函数
  

</script>

资源链接

文档官网:xiyueta.com/doc/

在线演示:xiyueta.com/demo/

Gitee仓库:gitee.com/313801120/xiyueta

Github仓库:github.com/313801120/xiyueta

更新日志:xiyueta.com/doc/log/

技术交流群:扫如下二维码加群

image